Site icon i2tutorials

DBMS- Dead-Lock

Dead-Lock

 

In schedule-2, there are two transactions T3 and T4. They are partially executed one after the other (T31, T41, T32).

 

In the sub transaction T31 there are 4 instructions.

In the sub transaction T42 there are 3 transactions.

In the sub transaction T32 there is 1 transaction.

 

Here, T31 is holding an exclusive lock on B.

 T41 is holding a shared lock on A.

 T32 is holding an exclusive lock on A.

and T41 is waiting for T31 to unlock B.

 T32 is waiting for T41 to unlock A.

 

Therefore, we are at a state where neither of these transactions can ever proceed with its normal execution. This situation is called ‘DEAD LOCK’.                     

 

When a deadlock occurs, the system should roll back one of the two transactions. Once a transaction is rolled back, then the data items that were locked by that transaction are unlocked.

To avoid this situation, one must require that each transaction in the system follow a set of rules, called a ‘locking protocol’.

 

Granting of Locks : 

 

Reference Link

Dead-Lock

Exit mobile version