5.4 Two-Phase Locking
Basic locking - Each transaction sets a lock on each data item before accessing the data
- the lock is a reservation
- there are read locks and write locks
- if one transaction has a write lock on x, then no other transaction can have any lock on x
Example
- rli[x], rui[x], wli[x], wui[x] denote lock/unlock operations
- wl1[x] w1[x] rl2[x] r2[x] is impossible
- wl1[x] w1[x] wu1[x] rl2[x] r2[x] is OK