17-04-2017, 11:22 AM
In a multithreaded system, blocking is an unwanted situation that arises in a shared resource environment, where one process indefinitely waits for a resource that is in another process.
For example, suppose a set of transactions {T0, T1, T2, ..., Tn}. T0 needs an X resource to complete his task. The resource X is retained by T1, and T1 is waiting for a resource Y, which is retained by T2. T2 is waiting for resource Z, which is retained by T0. Therefore, all processes wait for each other to release resources. In this situation, none of the processes can complete its task. This situation is known as a deadlock.
Deadlocks are not healthy for a system. In the event that a system is locked in a deadlock, the transactions involved in the lock are re-enabled or restarted.
Deadlock Prevention
To avoid any deadlock situation on the system, the DBMS aggressively inspects all operations, where transactions are about to run. The DBMS inspects the operations and analyzes if they can create a deadlock situation. If you find that a deadlock situation may occur, then that transaction can never be executed.
There are deadlock prevention schemes that use the mechanism to sort the transaction due dates in order to predetermine a deadlock situation.
For example, suppose a set of transactions {T0, T1, T2, ..., Tn}. T0 needs an X resource to complete his task. The resource X is retained by T1, and T1 is waiting for a resource Y, which is retained by T2. T2 is waiting for resource Z, which is retained by T0. Therefore, all processes wait for each other to release resources. In this situation, none of the processes can complete its task. This situation is known as a deadlock.
Deadlocks are not healthy for a system. In the event that a system is locked in a deadlock, the transactions involved in the lock are re-enabled or restarted.
Deadlock Prevention
To avoid any deadlock situation on the system, the DBMS aggressively inspects all operations, where transactions are about to run. The DBMS inspects the operations and analyzes if they can create a deadlock situation. If you find that a deadlock situation may occur, then that transaction can never be executed.
There are deadlock prevention schemes that use the mechanism to sort the transaction due dates in order to predetermine a deadlock situation.