Deadlock Recovery

First, we detect the deadlock through the Resource allocation graph method. If there is no deadlock in the graph, then there is no problem. Otherwise, we follow one of the following deadlock recovery methods to remove the deadlock.

1. Kill One/All Deadlocked Processes

Kill one process and check the deadlock status. If a deadlock is removed, then the system is deadlocked free; otherwise, kill one more process, and so on, continues killing the other processes until the deadlock is removed. In simple words, kill all those processes which are involved in a deadlock situation. Definitely, it hampers the performance of the system.

2. Preempt Resources

Preempt the resources from those processes that are involved in the deadlock and assign these resources to other processes that are not involved in the deadlock. So that the system can be recovered from deadlock. But starvation increases in the system.

3. Roll Back Resource

Roll back the resource until the deadlock is eliminated.