4,895 views
0 votes
0 votes
Consider the following synchronization construct used by the processes P1, P2, and P3. The S1, S2 and S3 are counting semaphore variables:

S1 = 3, S2 = 2, S3 = 1;

P(S1);
P(S2);
P(S3);

Critical Section

V(S3);
V(S2);
V(S1);

Does it satisfy mutual exclusion, progress and bounded waiting?

2 Answers

1 votes
1 votes

The answer should be It satisfies both bounded waiting and progress but not mutual exclusion.

At any time when each down operation is performed, the values will be S1 = 2, S2 = 1, S3 = 0 and all can enter the critical section at once. Thus no mutual exclusion

0 votes
0 votes

Yes, mutual exclusion, bounded waiting, and progress all are satisfied.

Reason: If you run the program concurrently then you will notice that at any time period, only 1 process can enter CS because Semaphores have been initialized in that particular order. Here, bounded waiting (blocking definition – By Deepak Sir) should be taken into use. What happens in this kind of bounded waiting is whenever a process is willing to enter a CS and if the process gets the chance to enter then bounded waiting is satisfied. The question must have come to your mind that what if P1 keeps repeating itself and P1 doesn’t get the chance?

Yes, I agree with that too but as per the authors if other processes are willing to enter the CS and semaphores are initialized to a particular which can help them bypass the entry then we can say bounded waiting is satisfied. Progress is also satisfied as the process need not starve for its chance. The reason being the same as above mentioned for bounded waiting.

Related questions

0 votes
0 votes
0 answers
2
1 votes
1 votes
1 answer
3
LavTheRawkstar asked Feb 28, 2017
13,093 views
Consider the Knapsack incidence with n=3(items) with weights {w1,w2,w3}={2,3,4} and profits are {p1,p2,p3}={1,2,5}Given the capacity is 5,{W/M = 5 } Find the optimal solu...
0 votes
0 votes
2 answers
4