Dedlock Notes
Dedlock Notes
What is Deadlock?
Deadlock is a situation in computing where two or more processes are
unable to proceed because each is waiting for the other to release
resources. Key concepts include mutual exclusion, resource holding,
circular wait, and no preemption.
Consider an example when two trains are coming toward each other
on the same track and there is only one track, none of the trains can
move once they are in front of each other. This is a practical example
of deadlock.
Examples of Deadlock
There are several examples of deadlock. Someof them are mentioned
below.
1. The system has 2 tape drives. P0 and P1 each hold one tape drive
and each needs another one.
2. Semaphores A and B, initialized to 1, P0, and P1 are in deadlock as
follows:
• P0 executes wait(A) and preempts.
• P1 executes wait(B).
• Now P0 and P1 enter in deadlock.