Deadlock recovery is generally used when deadlocks are rare and the cost of recovery is low.
Methods for Recovery
- Termination of processes
- Some victim process is chosen for termination from the cycle of deadlocked processes.
- This process is terminated, requiring a later restart
- All the resources allocated to this processes are released, so that they may be reassigned to other deadlocked processes
- With an appropriately chosen victim process, this should resolve the deadlock
- 2.Rolling back processes
- In order to rollback a victim process, there needs to have been some previous checkpoint at which time the state of the victim process was saved to stable storage
- There must also be an assurance that the rolled back process is not holding any resource needed by the other deadlocked processes at that point
- With an appropriately chosen victim process, needed resources will be released and assigned to other deadlocked processes.
- This resolves deadlock.