Deadlock Recovery
- Once the deadlock has been detected in the system, the system should now be recovered from this state.
- There is must because it will continuously degrade the performance of the system.
- If no correction mechanism is applied, there is a possibility of total system failure.
There are two different methods used to recover from the deadlock state:
- Process termination
- Resource preemption
1. Process Termination
One way to recover from deadlock state is to abort the deadlocked processes and reclaim all the resources allocated to them.
There are two different approaches for this :
- Abort all deadlocked processes
- Abort one process at a time until the deadlock cycle is eliminated
While selecting one of the deadlocked processes for abortion several factors must be kept in mind :
- Priority of the process.
- Amount of work already done by the process and amount of work that is still to be done.
- The type and the number of resources the process has used.
- The number of resources that a process still need in order to complete.
- Whether the process is batch or interactive.
2. Resource preemption
In this technique, the some resources are preempted from processes and are given to other processes till the deadlock cycle is broken. There are three issues related to resource preemption :
- Which resources and which process should become the target of preemption?
- What should be done with the preempted process ?
- How to ensure that starvation will not occur in the system ?