Skip to content
Related Articles

Related Articles

MOSS Concurrency Control Protocol (Distributed Locking in Database)
  • Difficulty Level : Easy
  • Last Updated : 29 Dec, 2020

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(hierarchal) 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(descendent).

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 descendent can acquire the lock.

g) As soon as a transaction becomes a retainer of the descendent 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(descendent) 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 descendent’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

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :