Deadlock recovery performs when a deadlock is detected.
When deadlock detected, then our system stops working, and after the recovery of the deadlock, our system start working again.
Therefore, after the detection of deadlock, a method/way must require to recover that deadlock to run the system again. The method/way is called as deadlock recovery.
Here are various ways of deadlock recovery that we will discuss briefly in this tutorial.
Let's discuss about all the above three ways of deadlock recovery one by one.
The ability to take a resource away from a process, have another process use it, and then give it back without the process noticing. It is highly dependent on the nature of the resource.
Deadlock recovery through preemption is too difficult or sometime impossible.
In this case of deadlock recovery through rollback, whenever a deadlock is detected, it is easy to see which resources are needed.
To do the recovery of deadlock, a process that owns a needed resource is rolled back to a point in time before it acquired some other resource just by starting one of its earlier checkpoints.
This method of deadlock recovery through killing processes is the simplest way of deadlock recovery.
Sometime it is best to kill a process that can be return from the beginning with no ill effects.