6.7 Deadlock recovery


When a deadlock is detected, two approaches can be done. One approach aborts one or more processes to break the circular wait. The other approach preempts some resources from one or more of the deadlocked processes.

Process termination
Aborting processes to eliminate deadlocks can be done in one of two methods:
Abort all deadlocked processes.
Abort one process at a time until the deadlock cycle is eliminated. The order in which the processes will
be aborted can be according to the following factors:
Priority of the process
How long process has computed, and how much longer to completion
Resources the process has used
Resources process needs to complete
How many processes will need to be terminated
Is process interactive or batch?

6.7 Deadlock recovery


Resource preemption
If resource preemption is required to deal with deadlocks, then three issues need to be addressed:
Selecting a victim: The order of processes to be aborted has to be chosen to minimize the cost.
Rollback: The aborted process must be rolled back to some safe state and restart it from that state.
Starvation: We need to guarantee that the same process will not be always picked as victim.