/    /  DBMS- Lock-Compatibility Matrix(2)

Lock-Compatibility Matrix(2)

 

This article is in continuation with the previous article, please go through it to understand this one effectively.

 

In this part we will be seeing the same transactions in the previous part but with unlocking delayed on each transaction. Unlocking delayed means the locks on each transaction are removed(Unlocking) at the end. 

 

Let there be a transaction T3 corresponding to T1 with unlocking delayed.

Transaction T3 :  lock-X(B) ;

 read (B) ;

    B = B – 50 ;

 write (B) ;

 lock-X(A) ;

 read (A) ;

 A = A + 50 ;

 write (A) ;

 unlock (B) ;

 unlock (A) ; 

Let there be a transaction T4 corresponding to T2 with unlocking delayed.

 

Transaction T4 :  lock-S(A) ;

   read (A) ;

 lock-S(B) ;

 read (B) ;

 display ( A + B )

   unlock (A) ;

 unlock (B) ;

 Now, consider the following partial schedule :

  

Schedule-2 : 

T3T4
Lock-X(B)

read(B);

B=B-50;

write(B);

lock-S(A)

read(A)

lock-S(B)

lock-X(A)

 

 

Reference Link

Lock-Compatibility Matrix(2)