Describe the necessary conditions for Deadlock.
Required conditions for deadlock
1. Mutual exclusion
2. Hold and wait
3. No preemption
4. Circular wait
Mutual exclusion: This condition must hold for non sharable resources. For illustration, a printer cannot be concurrently shared by several processes. Shared resources conversely, do not need mutually exclusive access, and therefore cannot be included in the deadlock. Generally, however this is not possible to prevent deadlocks through denying the mutual exclusion condition.
Hold and wait: To make sure that the hold and wait condition never arises in the system; we should guarantee that, whenever a process requests a resource, this does not hold any other resources. Processes may requests several resources and use them before such can request any other resources, as it should release all the resources that this is currently allocated.
No preemption: The third essential condition is that here is no preemption of resources which have already been allocated. If a process that is holding several resources requests other resource that this cannot be instantly allocated to this. Then all resources presently being held are preempted.
Circular Wait: One way to make sure that the circular wait condition never holds is to impose a total ordering of all resources kinds, and to make sure that each process requests resources in a rising order of enumeration.