- The strategy of deadlock prevention is to design a system in such a way that the possibility of deadlock is excluded a priori
- Methods for preventing deadlock are of two classes:
- indirect methods prevent the occurrence of one of the necessary conditions listed earlier.
- direct methods prevent the occurrence of a circular wait condition.
- Deadlock prevention strategies are very conservative; they solve the problem of deadlock by limiting access to resources and by imposing restrictions on processes
- Make it impossible that one of the four conditions for deadlock arise
- Mutual exclusion
- In general, this condition cannot be disallowed
- we can avoid assigning resources when not absolutely necessary
- as few processes as possible should claim the resource
- Hold-and-wait
- The hold and-wait condition can be prevented by requiring that a process request all its required resources at one time, and blocking the process until all requests can be granted simultaneously
- Can we require processes to request all resources at once?
- Most processes do not statically know about the resources they need
- Wasteful, but works
- No preemption
- One solution is that if a process holding certain resources is denied a further request, that process must release its unused resources and request them again, together with the additional resource
- Preemption is feasible for some resources (e.g., processor and memory), but not for others (state must be saved and restored)
- Circular Wait
- The circular wait condition can be prevented by defining a linear ordering of resource types. If a process has been allocated resources of type R, then it may subsequently request only those resources of types following R in the ordering
- order resources by an index:
- requires that resources are always requested in order
- holds and requests , and holds and requests is impossible
- sometimes a feasible strategy, but not generally efficient
2004-05-25