Operating System Concepts
Operating System Concepts
Deadlock is a situation where two or more processes are unable to proceed because each is waiting
for the other to release a resource.
Example:
Consider two processes, P1 and P2, and two resources, R1 and R2:
1. P1 holds R1 and requests R2.
2. P2 holds R2 and requests R1.
Since both are waiting indefinitely, a deadlock occurs.
Detection Methods:
- Resource Allocation Graph (RAG): A cycle in the graph indicates deadlock.
- Wait-for Graph: A directed cycle suggests deadlock.
- Deadlock Detection Algorithm: Detects deadlock dynamically.