Operating System - What Causes Deadlock
At least one of the four conditions that hold simultaneously in the system to cause deadlock that are:
Mutual exclusion
At a time only one process can use the resources. For that keep at least one resource is in nonsharable mode. If the another process request that resource, then the requesting process must wait until the resource has been released.
Hold and Wait
The process already holds one resource and waiting to request for the additional resources that are currently being held by the other processes.
No Preemption
The resources cannot be preempted. The resources can be released after that process has completed its task.
Circular wait
A set of processes(P1,P2, P3....Pn) in which the process P1 requests the resource that is held by the process P2. So the P1 is waiting for that resource. Similarly P2 waiting for the resource that is held by P3....Pn waiting for the resource that is held by P1. These processes form the circular wait or chain where each process is waiting for the resource that are held by the next process in the circle.
