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.Consider two processes P0 and P1 executing the following code segments. The

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!