Question: I hear that Oracle mutexes are a
faster way to serialize library cache operations, and I want to use
mutex in my Oracle 11g database. How do I enable a mutex latching
mechanism in my Oracle database?
Answer: Mutexes are objects that exist within the operating system to
provide access to shared memory structures. They are similar to
latches, which will be covered in following chapters, as they are
serialized mechanisms used to control access to shared data
structures within the Oracle SGA.
Serialization provides benefits via mutexes in that they are
required to avoid having database objects being read during
modification and to provide consistency as part of the relational
database ACID (Atomicity, Consistency, Isolation and Durability)
model.
Mutexes can be used and defined in various ways. Each data
structure within Oracle which is under the protection of a mutex
can also have its own mutex such as a parent cursor may have its
own separate mutex as well as each child cursor can also have its
own mutex. Structures within Oracle can be protected by
multiple mutexes so that each mutex will protect a different area
of the database structure. While latches and mutexes are similar
regarding both being serialization mechanisms and providing data
protection, mutexes differ from latches in the following ways.
Mutexes are smaller and operate faster than latches because
they contain fewer instructions than those in a latch get
operation. Secondly, mutexes take up fewer memory resources and
space than latches. Mutexes also provide less chance of contention
within the database than latches do which means that mutexes
provide greater protection of data structures and flexibility than
latches.
Another key feature of mutexes is that they can be
referenced across many sessions concurrently by using shared mode.
Mutexes also function in a dual role as both a serialization item
similar to a latch and also as pin operator by preventing objects
from aging out of the Oracle memory buffers. Since both
latches and mutexes are independent mechanisms, a process within
Oracle can hold both a latch and mutex at the same time.
Oracle 10g release 2 and beyond replaced some latch mechanisms
with the mutex approach, claiming that they are faster and more
efficient than traditional locking mechanisms. To improve cursor
execution speed and hard pare time within the library cache, mutexes
replace library cache latches and library ache pins. Oracle claims
that mutexes are faster and use less CPU, which is important for
CPU-bound database where large data buffers remove I/O as a primary
source of contention.
Oracle also claims that a mutex allows for improved concurrency
over the older latch mechanism because the code path is shorter.
Beware, Oracle bug 5184776
can affect 11g databases that deploy the mutex latching, causing
excessive ‘cursor pin s wait on x’ wait events.
Also see my notes on
v$mutex_sleep.
|
|
|
|
Guarantee your Success!
Oracle is the
world's most complex, robust and flexible database, considered
impossible to master without a mentor.
That's why all BC
Oracle trainers are working professionals, experts in Oracle who
share their tips and secrets. |
|
| |
|
Burleson is the American Team

Note:
This Oracle
documentation was created as a support and Oracle training reference for use by our
DBA performance tuning consulting professionals.
Feel free to ask questions on our
Oracle forum.
Verify
experience!
Anyone
considering using the services of an Oracle support expert should
independently investigate their credentials and experience, and not rely on
advertisements and self-proclaimed expertise. All legitimate Oracle experts
publish
their Oracle
qualifications.
Errata?
Oracle technology is changing and we
strive to update our BC Oracle support information. If you find an error
or have a suggestion for improving our content, we would appreciate your
feedback. Just
e-mail:
and include the URL for the page.
Copyright ? 1996 - 2012
All rights reserved.
Oracle ?
is the registered trademark of Oracle Corporation.
|
|