Enqueues
are another type of locking mechanism used in Oracle. An enqueue is a
more sophisticated mechanism which permits several concurrent processes
to have varying degree of sharing of "known" resources. Any object which
can be concurrently used, can be protected with enqueues. A good
example is of locks on tables. We allow varying levels of sharing on
tables e.g. two processes can lock a table in share mode or in share
update mode One difference is that the enqueue is
obtained using an OS specific locking mechanism. An enqueue allows the
user to store a value in the lock, i.e the mode in which we are
requesting it. The OS lock manager keeps track of the resources locked.
If a process cannot be granted the lock because it is incompatible with
the mode requested and the lock is requested Latch waiters may either use timers to wakeup and retry or spin (only in multiprocessors). Since all waiters are concurrently retrying (depending on the scheduler), anyone might get the latch and conceivably the first one to try might be the last one to get. |
Latches and enqueues >