Deadlock Detection And Recovery

By | September 13, 2020

Deadlock Detection and Deadlock recovery are important tasks of OS. If deadlocks are not avoided, then another approach is to detect when they have occurred and recover somehow.

These are explained as following below.

1. Deadlock Detection :

  1. If resources have single instance :
    If cycle exist in the Resource Allocation Graph, then there exist deadlock in the system. That means, Presence of cycle in the Resource Allocation Graph is the sufficient condition for deadlock.

  2. If there are multiple instances of resources :
    If cycle exist in the Resource Allocation Graph, then there deadlock may possible in the system. That means, Detection of the cycle in the Resource Allocation Graph is necessary but not sufficient condition for deadlock detection.
    In this case, the system may or may not be in deadlock varies according to different situations.

2. Deadlock Recovery :
In order to recover the system from deadlocks, either OS considers resources or processes.

  • Killing the process :
    killing all the process involved in the deadlock. Killing process one by one.
  • Resource Preemption :
    Resources are preempted from the processes involved in the deadlock, preempted resources are allocated to other processes. In this, there may be chance of starvation of a low priority process.



Please write comments if you find anything incorrect. A gentle request to share this topic on your social media profile.