- A binary lock can have two states or values: locked and unlocked ( 0 or 1)
- A distinct lock is associated with each database item X.
- if the value of the lock on X is 1. item X cannot be accessed by a DB operation that requests the item.
- if the value of the lock on X is 0, the item can be accessed when requested.
if the simple binary locking scheme described above is used, every transaction must obey the following rules:
- A transaction T must issue operation Lock(A) before performing Read(A) or Write(A).
- T must issue Unlock(A) after finishing all operations.
- T will not issue a Lock(A) operation if the data item A is already locked by it.
- T will not issue an Unlock(A) operation if the data item A is not locked by it.
These rules must be enforced by the lock manager module of the DBMS.
At most one transaction can hold the lock on a particular item. Thus, no two transactions can access the same item concurrently.
Database Blogs : https://codewithsudeep.com/category/database/