Two processes accessing two semaphores:---P0 P1wait(S); wait(Q);Wait(Q); wait(S);................................signal(S); Signal(Q);signal(Q); Signal(S);P0 executes wait(S) |P1 executes wait(Q) |P0 executes wait(Q)P0 has to wait until P1 executes signal(Q)Similarlywhen P1 executes wait(S) it must wait until P0 executes signal(S)Since these signal operations cant be executed so DEADLOCK
Two processes accessing two semaphores:---
ReplyDeleteP0 P1
wait(S); wait(Q);
Wait(Q); wait(S);
................................
signal(S); Signal(Q);
signal(Q); Signal(S);
P0 executes wait(S)
|
P1 executes wait(Q)
|
P0 executes wait(Q)
P0 has to wait until P1 executes signal(Q)
Similarly
when P1 executes wait(S) it must wait until P0 executes signal(S)
Since these signal operations cant be executed so DEADLOCK