June 2001
Intermediate to advanced
688 pages
19h 18m
English
Berkeley DB uses a locking protocol called two-phase locking (2PL). This is the traditional protocol used in conjunction with lock-based transaction systems.
In a two-phase locking (2PL) system, transactions are broken up into two distinct phases. During the first phase, the transaction only acquires locks; during the second phase, the transaction only releases locks. More formally, once a transaction releases a lock, it may not acquire any additional locks. Practically, this translates into a system in which locks are acquired as they are needed throughout a transaction and retained until the transaction ends, either by committing or aborting. In Berkeley DB, locks are released during txn_abort