Operating System - What Causes Deadlock - Necessary Conditions
There may be many reasons or causes why a deadlock occursAt least one of the four conditions that hold simultaneously in the system to cause deadlock that are:
At a time only one process can use a resource. 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.
The resources cannot be preempted. The resources can be released after that process has completed its task.
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.