/    /  DBMS- Multiple Granularity Locking Protocol

Multiple Granularity Locking Protocol

 

This protocol uses these lock modes to ensure serializability.

                                                                                        

It requires that a transaction ‘Ti’ that attempts to lock a node ‘Q’ must follow the below rules:

 

(a) Transaction Ti must observe the Lock-Compatibility function.

 

(b) Transaction Ti must lock the tree’s root first and can look at it in any mode.

 

(c) Transaction Ti can lock a node Q in S or IS mode only if transaction Ti currently has the Parent of Q locked in either IX or IS mode.

 

(d) Transaction Ti can lock a node Q in X, SIX, or IX mode only if transaction Ti currently has the parent of Q locked in either IX or SIX mode.

 

(e) Transaction Ti can lock a node only if transaction Ti has not previously unlocked any node.

(f) Transaction Ti can unlock a node Q only if transaction Ti currently has none of the children of Q locked.

 

EXAMPLE-1 :

(a) Suppose that Transaction T21  reads a record REC-A2 in FILE-A. Then, T21 needs to lock the database, AREA-1 and FILE-A in IS mode, and finally to lock REC-A2 in S mode.

 

(b) Suppose that Transaction T22 modifies REC-A9 in FILE-A. Then, T22 needs to lock the database, AREA-1 and FILE-A in IX mode, and finally to lock REC-A9 in X mode.

 

(c) Suppose that Transaction T23 reads all the records in FILE-A. Then, T23 needs to lock the database and AREA-1 in IS mode, and finally to lock FILE-A in S mode.

 

(d) Suppose that Transaction T24 reads the entire database. After locking the database in S mode, it can do so.

 

Reference Link

Multiple Granularity Locking Protocol