Latch & lock difference - Database

Q.  State the main difference between a latch and a lock.
- Published on 27 Aug 15

a. Locks are more restrictive than Latches in that they are always exclusive.
b. Latches are more restrictive than locks in that they are always exclusive.
c. Latch is used to protect data while lock is not.
d. Lock is used to protect data while latch is not.

ANSWER: Latches are more restrictive than locks in that they are always exclusive.
 

    Discussion

  • Nirja Shah   -Posted on 02 Nov 15
    - Latch is an internal Oracle mechanism used to protect data structures in the SGA from simultaneous access.

    - Atomic hardware instructions like TEST-AND-SET are used to implement latches.

    - Latches are more restrictive than locks in that they are always exclusive.

    - Latches are never queued, but will spin or sleep until they obtain a resource, or time out.

    - Locks support queueing and concurrency.

    - They are queued and serviced in a first-in-first-out (FIFO) order.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)