Deadlock Recovery | Methods for Recovery

Deadlock Recovery

Deadlock recovery is generally used when deadlocks are rare and the cost of recovery is low.

Methods for Recovery

  1. Termination of processes
  • Some victim process is chosen for termination from the cycle of deadlocked processes.
  • This process is terminated, requiring a later restart
  • All the resources allocated to this processes are released, so that they may be reassigned to other deadlocked processes
  • With an appropriately chosen victim process, this should resolve the deadlock


  • 2.Rolling back processes
  • In order to rollback a victim process, there needs to have been some previous checkpoint at which time the state of the victim process was saved to stable storage
  • There must also be an assurance that the rolled back process is not holding any resource needed by the other deadlocked processes at that point
  • With an appropriately chosen victim process, needed resources will be released and assigned to other deadlocked processes.
  • This resolves a deadlock.


The ostrich approach:

This algorithm ignores the deadlock problem.


In general, there are four strategies of dealing with deadlock problem:

1. The Ostrich Approach

Just ignore the deadlock problem altogether.

2. Deadlock Detection and Recovery

Detect deadlock and, when it occurs, take steps to recover.

3. Deadlock Avoidance

Avoid deadlock by careful resource scheduling.

4. Deadlock Prevention

Prevent deadlock by resource scheduling so as to negate at least one of the four conditions.

Recovery from Deadlock

Recovery from Deadlock

When a system is deadlocked there two possibilities to recover from deadlock;

  • one is simply to abort one or more process to break circular wait, and other is preempt some process which are involved in the deadlock.
  • In order to abort a process; we check the priority of process, completion time, resources used, how many processes will need to be terminated etc.
  • Recovery from  deadlock is simply abort all deadlocked and reclaim resources.
  • Resources preemption is also one of the solution for deadlock recovery.