Necessary condition to occur deadlock, mutual exclusion, no preemption in operating systems
Last modified on December 11th, 2018 at 11:49 am
What is the deadlock?
A process P1 holing some resources and waiting for some another resource that is held by some another Process P2. Similarly, P2 has some resources and waiting for some resources held by P1. In this condition, both processes are deadlocked. None of them can complete their execution.
What are four necessary conditions to occur deadlock?
If these four conditions occur simultaneously, then it is the deadlock.
If a resource is shareable and can be accessed by more than one process at the same time. Then it leads to deadlock.
Hold and wait
If one process holding a resource and waiting for another resource that is held by another process. Then it leads to deadlock.
If processes are waiting for resources in a circle. For example, P1 is holding Resource R1 and waiting for resource R2. Similarly, P2 holding resource R2 and waiting for resource R1 as represented in figure 1.Then it leads to deadlock.
If we have set no priority for all processes, then every process demands that it will execute first and utilize the resources. Then it leads to deadlock.