in Operating System
1,154 views
2 votes
2 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);
(S1);
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.

in Operating System
by
1.2k views

14 Comments

A?
1
1
is it D?
0
0
edited by
A it is

EDIT:- sorry...m wrong...if a while true function would have been at beginning then we won't have a bounded waiting...here process locks does it work ,up the semaphore and terminates finally.D will be answer
1
1
moved by
A it is
0
0
if the data structure has queue for blocked processes ===> it is bounded waiting
0
0
edited by

@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
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
0
ya ok while typing the explanation I got where i am going wrong. All 3 should be satisfied.
0
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
0
semaphores by default have a queue for blocked processes
1
1

@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
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
0

@MANSI_SOMANIV(s3) by p1 means, p1 is not out of critical section, rt?

0
0
Yes sir sorry forgot that, cz I was thinking like process still not exit as did preemption ,still in execution

But here it's out of critical section

Thanks sir
1
1

1 Answer

1 vote
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.
selected by

1 comment

can you tell how ME is satisfied???
0
0