in Operating System
4,878 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?
in Operating System
4.9k views

4 Comments

If don't have the queue, then where it will keep the blocked process??

 

0
0
Question is correct.!!
0
0

@Lakshman Patel RJIT

Peterson's algo, also single code but bounded wait is satisfied..

Here the queue property of binary semaphore is used to ensure bounded wait.

0
0

2 Answers

1 vote
1 vote

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.

2 Comments

There is a case when p1 have to wait indefinitely.Comment if i am wrong.

0
0
You’re absolutely right!! This code satisfies everything but bound waiting.
0
0

Related questions