Open In App

MOSS Concurrency Control Protocol (Distributed Locking in Database)

Improve
Improve
Like Article
Like
Save
Share
Report

This is a protocol which is used to control the concurrency in the Distributed database environment, Here we’ll read about the rules and regulations that are required to keep in mind while applying MOSS Concurrency Control Protocol.  

MOSS Concurrency Control Protocol:- 

a) It is mainly used for handling the nested(hierarchical) transactions which are based on inheritance.

b) Consider a Transaction(T) acquire a lock on a data-item(X) in some mode(M).

c) The Transaction(T) holds the lock in mode(M) until it terminates.

d) When anyone subtransaction(T1) of T commits, then its parent Transaction occupies or inherits that lock and retains until all subtransaction can’t finish. 

e) If a transaction holds a lock on a data-item(X) so, It has the right to access the locked data-item(X) in the corresponding mode. However, it is not valid in case if a transaction retained a lock from any other some subtransaction(descendant).

f) A retained lock is only a just a kind of placeholder and indicates that the subtransactions that are out of corresponding hierarchy can’t acquire the lock, but descendant can acquire the lock.

g) As soon as a transaction becomes a retainer of the descendant subtransaction S’s lock, it remains a retainer until the transaction finishes.

General Locking rules regarding this Protocol:-

a) Subtransaction(T1) may acquire a read lock over a data-item(X) if:

    a.1) no other subtransaction(descendant) holds the write lock on X, and 

    a.2) All the subtransactions that have retained a write lock on X are ancestors of subtransaction(S).

b) Subtransaction(T1) may acquire a write-lock on a data-item(X) if:

     b.1) no other subtransaction holds a read/write lock on X, and

     b.2) all subtransactions that have retained a read/write lock on X are ancestors of T1.

c) When a subtransaction(T1) completes its execution, the parent of T1 inherits(retains) the lock held by T1 in the same mode as was held by T1

Fig.c

d) When a top-level of subtransactions(T3) commits all of its descendant’s release the held locks along with retained locks.

Fig.d

e) When a subtransaction(T3) aborts, it releases all of its held locks along with retained locks. All subtransactions originated from an aborting transaction are also aborted and must start from the very beginning if they have started their execution.

Fig.e


Last Updated : 02 Nov, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads