Question: Consider two processes P0 and P1 executing the following code segments. The two processes are not allowed to be inside their critical sections at the
Consider two processes P0 and P1 executing the following code segments. The two processes are not allowed to be inside their critical sections at the same time. A and B are two semaphores initialized to 1.
a) Under what conditions can this synchronisation procedure lead to a deadlock?
b) How can the possibility of a deadlock be eliminated by changing the order of the wait and/or signal statements? Any change you make should not enable the two processes to enter their critical sections concurrently.
c) How can the possibility of a deadlock be eliminated by changing the initialization values of the semaphores? Any change you make should not enable the two processes to enter their critical sections concurrently.
po wait (A); wait (B); wait (B); wait (A); critical section critical section signal (B); signal (A); signal (A); signal (B)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
