Two-Phase Locking and Serial Order

Separate a transaction’s growing and shrinking lock phases and use its last acquisition to explain conflict serializability.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Once lock release begins, acquisition ends
  2. Last acquisition orders conflicting transactions

Once lock release begins, acquisition ends

Two-phase locking requires each transaction to acquire locks only before it starts releasing them, with modes that conflict as the modeled operations do. Transactions can release at different times. Strict variants keep specified write locks through commit or abort to aid recovery and prevent access to unfinished changes.

Last acquisition orders conflicting transactions

If a conflicting operation of A occurs before B’s access to the same protected item, B must acquire its conflicting lock after A releases the relevant lock. A’s last acquisition lies before that release. B’s last acquisition lies at or after its conflicting acquisition. Ordering by the last acquisition therefore respects the conflict edges in this model. Waiting can still cause deadlock. Precedence graphs define the serializability claim.[1][2]

References

  1. CMU 15-445/645, Introduction to Database Systems: Lectures ↩
  2. Hal Berenson et al., A Critique of ANSI SQL Isolation Levels ↩