Question: 22. Suppose s and t are two semaphores initialized with init(s) and init(t). Consider the following code fragment of two concurrent processes: * (a) Does
22. Suppose s and t are two semaphores initialized with init(s) and init(t). Consider the following code fragment of two concurrent processes:

*
(a) Does the algorithm guarantee mutual exclusion? If not, show an execution sequence that lets both processes run in their critical sections simultaneously.
(b) Does the algorithm prevent deadlock? If not, show an execution sequence that deadlocks P1 and P2.
Process P1 Process P2 wait(s); wait(t); wait(t); wait(s); critical section critical section signal(s); signal(t); signal(t); signal(s); remainder section remainder section
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
