Dark Mode

himgta
asked
in Operating System
Dec 12, 2018

1,154 views
2 votes

Consider the following synchronization construct used by the processes *P*1, *P*2 and *P*3. The *S*1, *S*2 and *S*3 are counting semaphore variables:

*S*1 = 3, *S*2 = 2, *S*3 = 1;

*P* (*S*1);

*P* (*S*2);

*P* (*S*3);

**Critical section**

*V* (*S*3);

*V* (*S*2);

*V *(*S*1);

Which of the below statement is true?

A It satisfies mutual exclusion and progress but not bounding waiting.

B It satisfies both progress and bounded waiting but not mutual exclusion.

C It satisfies mutual exclusion and bounded waiting but not progress.

D It satisfies all the mutual exclusion, progress and bounded waiting.

edited
Dec 12, 2018
by Shubhgupta

@Shaik Masthan, But in this case one process will always be blocked so from my thinking progress and bounded waiting is not satisfied.

EDIT- I was thinking that there is only 1 up operation will be performed on s3 so only 2 process will get chance to enter critical section but there are 2 up operation.

0

i am not getting why you are saying it is progress and bounded waiting are not satisfied !

please read my answer on https://gateoverflow.in/226875/critical-section

( even question is not same, it will help to solve this question )

0

if the data structure has queue for blocked processes ===> it is bounded waiting

@ Shaik Masthan but it is not given in the question ...without queue how we can assure there is bounded waiting.

0

@Shaik Masthan Sir, I think **bounded waiting is not guaranteed** because if we assume the following case:

S1=3 ; S2= 2 ; S3 = 1

================================

S1 : P1, P2 , P3 ( S1=0)

S2 : P1 , P2 (S2=0)

S3 : P1 (S3=0)

V(S3) : (S3=1)

V(S2) : (S4=1)

V(S1): (S1=1)

================================

Now P1 is out and again comes for execution

================================

S1 : P2, P3, P1 (S1=0)

S2 : P2, P1 (S2=0) --- P1 can go directly in S2 and so P3 will not get chance

S3 : P2 (S3=0)

Similarly P2 is out and again comes like P1

=================================

Here in this case P3 is waiting ……**because we are not keeping track of who came first and if the first comer should be executed before late comer.**

**Please tell me what’s wrong because i feel this should be correct !**

0

@Shaik Masthan Sir can you please explain how mutual exclusion is satisfied?? M getting 2 process together in critical section by preempting p1 in V(S3) and then brought P2

what's mistske here?

0

1 vote

Best answer

All are satisfied.

Progress is satisfied: As you see P1,P2,P3, Suppose P1 is not interested and P2 wants to get into CS then P1 won't stop to P2. So Progress is satisfied.

Bounded Waiting: Semaphores by default have a queue for blocked process but if not any scheduling algorithm mentioned(FCFS etc...) then also every process get the chance to get into CS.

Progress is satisfied: As you see P1,P2,P3, Suppose P1 is not interested and P2 wants to get into CS then P1 won't stop to P2. So Progress is satisfied.

Bounded Waiting: Semaphores by default have a queue for blocked process but if not any scheduling algorithm mentioned(FCFS etc...) then also every process get the chance to get into CS.