in Operating System
1,057 views
1 vote
1 vote

a)  s1-wait(p) , s2-wait(q) , s3-wait(q) , s4-wait(p)

b)  s1-wait(p) , s2-wait(q) , s3-wait(p) , s4-wait(q)

c)  s1-wait(q) , s2-wait(p) , s3-wait(p) , s4-wait(q)

d)  none of above

in Operating System
1.1k views

1 Answer

2 votes
2 votes

answer should be D

Option A)say we execute S1 that is DOWN on P then process P1 is preempted and P2 start execution so DOWN on Q

Now both P1 ans P2 are stuck as they cant do down on either P or Q so DEADLOCK may occure .

Option B) here if any of process either P1 or P2 do DOWN on P then it will get chance to access CS but can it gurentee the Bounded wait ??...it will not ..say P1 does DOWN on P now P2 cant do anything ,so it will wait ..now P1 can do Down on Q ..enter into CS and again Up on P and Q but there is no gurantee that P2 will do down on P ..it may possible that P1 again do this down on P ..and may run many times ...so BOUNDED WAIT DEFINATELY  ABSENT

Option C)P1 does down on Q then P2 will DOWN on P ..so again deadlock ...so it cant be option

Option D) Correct ...none of above gurantee "ME,BW,PROGRESS"

4 Comments

yes it will insure bounded waiting for 2 processes. for >2, processes, implementation of semaphore decides whether it will insure bounded waiting or not. if it will be a strong semaphore, then bounded waiting insured. if it will be a weak semaphore, then bounded waiting not insured.

[Strong semaphore: process that has been blocked the longest is released from the queue first.

Weak semaphore: semaphore doesn't specify the order in which processes are removed from the queue]
0
0

Definition of semaphore says if semaphore variable value is 0 and any process perform wait operation then process which performed that operation will be placed in queue....

And when any process perform signal operation now semaphore variable value will be 1 so , process which is in queue will be released to enter CS...

So bounded wait satisfy here

 

Right?? @Shubhgupta

0
0

Yes @, its correct but its not necessary that it should always be queue. It depends on the scheduling algo.

1
1