A review article about Deadlock Problem
The deadlock problem occurs in transnational databases when there is a set of blocked transactions each holding a piece of data and waiting to acquire another piece of held by another transaction in the set. Basically, two or more transactions wait for each other to unlock the data. No transaction can continue until other transaction has unlock the data.
Here is an example of deadlock-
Let two developers, developer 1 and developer 2 both want to update a set of two tables that are related. E.g. Table A & Table B. But there is a problem, since they are accessing the database simultaneously so when developer 1 was updating Table A the table is locked so no other transaction can access it. At the exact same time Table B is also locked because developer 2 is updating it. Finally, when developer 1 wants to use table B he finds it locked and same time when developer 2 wants to access Table A she finds it locked as well. So, both of them have to wait to do the transactions. In this case both can’t do their transactions which is caused deadlock.
What are the control techniques for deadlock?
Followings are control techniques for deadlock-
- Prevention
- Hold & Wait
- No Preemption
- Circular Wait
- Avoidance
- Deadlock avoidance algorithm
- Detection
- Deadlock detection algorithm
- Recovery Scheme