A deadlock occurs when two or more processes are waiting for each other's resources indefinitely, causing a system halt

Circle = Process
Square = Resource
Arrow from process to resource = process is requesting the resource
Arrow from resource to process = resource is allocated to the process
🧠 Key Insight:
If the graph contains a cycle, deadlock may occur.
Deadlock can happen only if all four of the following conditions hold simultaneously:
1. Mutual Exclusion: Resources cannot be shared — only one process can use at a time.
2. Hold and Wait: A process is holding at least one resource and waiting to acquire more.
3. Non-preemptive: A resource can’t be forcibly taken from a process holding it.
4. Circular Wait: A set of processes are waiting for each other in a circular chain
If even one of these is broken, deadlock can be prevented