Deadlock Prevention
Prevention is the name given to method that guarantee that deadlocks can never happen for the reason that the way the system is structured. Since 4 conditions are essential for deadlock to take place, it track that deadlock might be prevented by denying any one of the conditions.
- Elimination of "Mutual Exclusion" Condition
The mutual exclusion condition ought to hold for non-sharable resources. That is, several processes can't simultaneously share a single resource.
- Elimination of "Hold and Wait" Condition
There are two possibilities for exclusion of the second condition. The first substitute is that a process request be granted all of the resources it postulates at once, previous to execution. The second substitute is to disallow a process from requesting resources whenever it has previously allocated resources. This strategy needs that all of the resources a process will need must be requested at once.
- Elimination of "Non-preemption" Condition
The non-preemption condition is able to be alleviated by forcing a process waiting for a resource that cannot immediately be allocated to relinquish all of its currently held resources, thus that other processes may use them to finish.
- Elimination of "Circular Wait" Condition
The last condition the "circular wait" is able to be denied by imposing a total ordering on all of the resource types and then forcing all processes to request the resources in order (increasing or decreasing). This strategy compel a total ordering of all resources kinds, and to need that each process requests resources in a numerical order (increasing or decreasing) of enumeration. With this rule the resource allocation graph is able to never have a cycle.