WHAT ARE LATCHES AND WHAT CAUSES LATCH CONTENTION
星期三, 九月 24th, 2008The Oracle RDBMS makes use of different types of locking mechanisms.
They are mainly latches, enqueues, distributed locks and global locks
(used in parallel instance implementations).
This bulletin focuses on latches. It attempts to give a clear understanding
of how latches are implemented in the Oracle RDBMS and what causes latch
contention. The information provided can be used in tuning the various
kinds of latches discussed.
1. What is a latch?
Latches are low level serialization mechanisms used to protect shared
data structures in the SGA. The implementation of latches is operating
system dependent, particularly in regard to whether a process will wait
for a latch and for how long.
A latch is a type of a lock that can be very quickly acquired and freed.
Latches are typically used to prevent more than one process from
executing the same piece of code at a given time. Associated with each
latch is a cleanup procedure that will be called if a process dies while
holding the latch. Latches have an associated level that is used to
prevent deadlocks. Once a process acquires a latch at a certain level it
cannot subsequently acquire a latch at a level that is equal to or less
than that level (unless it acquires it nowait).
(全文…)
