Non-strict two-phase locking

From Wikipedia, the free encyclopedia

In computer science, non-strict two-phase locking, also 2PL, is a locking method used in concurrent systems.

The rules for 2PL are similar to those of Strict 2PL:

  1. If a transaction T wants to read/write an object, it must request a shared/exclusive lock on the object.
  2. A transaction cannot request additional locks on any object once it releases any lock, and it can release locks at any time (not only at commit time, as in Strict 2PL).

So, every transaction has a growing phase (it acquires locks) and a shrinking phase (it releases locks). 2PL allows only conflict serializable schedules, but doesn't guarantee that deadlocks will be avoided.

2PL is one scheduling algorithm, sometimes used instead of:

  • simultaneous locking, simultaneous release (Disadvantage: redundant locking, no interactive transactions)
  • incremental locking, simultaneous release (Disadvantage: Deadlock)
  • simultaneous locking, incremental release (Disadvantage: rollback, redundant locking)
  • incremental locking, incremental release (Disadvantage: deadlock, rollback)
Languages