Understand the Latches, Enqueues and mutexes in Oracle

Understand the Latches, Enqueues and mutexes in Oracle

Latches are low level serialization mechanism used to protect shared data structures in the SGA.
It is used to prevent more than one process from executing the same piece of code at a given time.
Its depend upon the operating system, whether a process will wait for a latch and for how long.
This lock is very quickly acquired and freed.
It also has cleanup process if process dies while holding lock. It done by PMON process.
Process acquire a latch when working in SGA. It holds and dropped when process is finished.


Enqueues is another locking mechanism used in oracle . It permits several concurrent processes to have varying degree of sharing the resources.
Concurrently used object , can be protected with enqueues.
Example table allow varying levels of sharing.
Two processes can be locked a table in share mode or in share update mode etc.

Mutexes like latches are a light-weight and more granular concurrency mechanism than latches.
It ensure that certain operations are properly managed for concurrency.
Example if one session is changing a data structure in memory, then another session must wait to acquire the mutexes.

Difference between Latches and Enqueues:

Enqueues is obtained using an OS specific locking mechanism.
Latch is obtained independent of the OS.

Latches there is no ordered queue of waiters.
Enqueues has ordered queue of waiters.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.