In computer science, non-strict two-phase locking, also 2PL, is a locking method used in database management systems.
The rules for 2PL are similar to those of Strict 2PL:
- If a transaction T wants to read/write an object, it must request a shared/exclusive lock on the object.
- A transaction cannot request additional locks on an object once it releases any lock, and it can release locks at any time (not only at commit time as in Strict 2PL).
2PL in action:
The deadlocked schedule in Strict 2PL:
does not need to be deadlocked in 2PL, since T1 and T2 can release its locks on its objects before the other transaction requests locks on the objects.