DEADLOCK RECOVERY

There are three basic approaches to recovery from deadlock:
1. Inform the system operator, and allow him/her to take manual intervention.
2. Terminate one or more processes involved in the deadlock
3. Preempt resources.
PROCESS TERMINATION:
Two basic approaches, both of which recover resources allocated to terminated processes:
ABORT ALL DEADLOCKED PROCESSES. This definitely solves the deadlock, but at the expense of terminating more processes than would be absolutely necessary.
ABORT ONE PROCESS AT A TIME UNTIL THE DEADLOCK CYCLE IS ELIMINATED. This is more conservative, but requires doing deadlock detection after each step.
In the latter case there are many factors that can go into deciding which processes to terminate next:
1. Process priorities.
2. How long the process has been running, and how close it is to finishing.
3. How many and what type of resources is the process holding. ( Are they easy to preempt and restore? )
4. How many more resources does the process need to complete.
5. How many processes will need to be terminated
6. Whether the process is interactive or batch.
RESOURCE PREEMPTION:
When preempting resources to relieve deadlock, there are three important issues to be addressed:
1. Selecting a victim - Deciding which resources to preempt from which processes involves many of the same decision criteria outlined above.
2. Rollback - Ideally one would like to roll back a preempted process to a safe state prior to the point at which that resource was originally allocated to the process. Unfortunately it can be difficult or impossible to determine what such a safe state is, and so the only safe rollback is to roll back all the way back to the beginning. ( i.e. abort the process and make it start over. )
3. Starvation - How do you guarantee that a process won't starve because its resources are constantly being preempted? One option would be to use a priority system, and increase the priority of a process every time its resources get preempted. Eventually it should get a high enough priority that it won't get preempted any more.

No comments:

Post a Comment