Systems Engineering and RDBMS

Latches, Locks, Enqueues and Semaphores

Posted by decipherinfosys on April 30, 2008

A developer at a client site asked this question yesterday – “I know what is the difference between latches and locks but what are enqueues and semaphores – I have heard those terms used by the DBAs a lot…could you explain those for me?”.

Our answer was that latches and enqueues are both types of locks where as a semaphore is an OS supplied serialization device which a programmer uses to implement latching/enqueuing.  Latches are essentially lightweight serialization devices.  They are similar to spinlocks that spins inside a loop for the bit to be cleared up by another process – it is a mutex (mutual exclusion device).  Latches are used to serialize access to memory data structures like the SGA data structures.  Enqueues on the other hand are heavyweight serialization devices.  Enqueues are used to perform row level locking.  Unlike latches, these are actual locks on the data records.

Sorry, the comment form is closed at this time.

 
%d bloggers like this: