RECOVERY FROM DEADLOCK
Recovery From Deadlock: -When a detection algorithm determines that a deadlock exists, then the system or operator is responsible for handling deadlock problem. There are two options for breaking a deadlock.
- Process Termination
- Resource preemption
There are two methods to eliminate deadlocks by terminating a process as follows:
- Abort all deadlocked processes: This method will break the deadlock cycle clearly by terminating all process. This method is cost effective. And it removes the partial computations completed by the processes.
- Abort one process at a time until the deadlock cycle is eliminated: This method terminates one process at a time and invokes a deadlock-detection algorithm to determine whether any processes are still deadlocked.
In resource preemption, the operator or system preempts some resources from processes and give these resources to other processes until the deadlock cycle is broken.
If preemption is required to deal with deadlocks, then three issues need to be addressed:
- Selecting a victim: The system or operator selects which resources and which processes are to be preempted based on the cost factor.
- Rollback: The system or operator must roll back the process to some safe state and restart it from that state.
Starvation: The system or operator should ensure that resources will not always be preempted by the same process?