|< < 24 > >|

Strict Two-Phase Locking

Lock implementation

The Lock Manager is shared

The lock manager is used by all running processes (or threads).

The data structures managed by the lock manager has to be accessible to all of these processes.

The implementation must be thread-safe. (Not the topic of this course.)

Lock Manager data structures

  • Lock table: A map, object → lock table entry.

  • Lock table entry:
    • Lock mode
    • Number of transactions currently locking the object, (≥ 1 for a shared lock)
    • Queue of (waiting transaction, lock mode).

  • Transaction table: For each transaction, the locks currently held.

|< < 24 > >|