/    /  DBMS- Lock-Based Protocols

Lock-Based Protocols


One way to ensure data isolation is to make sure that the data items are accessed in a mutually exclusive manner;  that is, if one transaction is accessing a data item, then the other transactions can’t modify that data item.


The common method used to implement this necessity is to allow one transaction to access a data item only if it is holding a lock currently, on that data item.


LOCKS: Locks are of two types, namely, 

 (a) Shared Lock(S): If a transaction Ti has acquired a shared-mode lock on item Q, then Ti can read Q, but cannot write Q.

 (b) Exclusive Lock (X):  If a transaction Ti has acquired an exclusive-mode lock on item Q, then Ti can both read and write, Q.


Every transaction requests a lock in an appropriate mode on every data item Q, depending on the type of operations that the transaction will perform on Q.


The transaction can only proceed with the operations after the concurrency-control manager grants the lock to access  the transaction.

The use of two lock modes allows multiple transactions to read a data item but limits the write access to just one transaction at a time.



Reference link

Lock-Based Protocols