527 views
1 votes
1 votes

1 Answer

–1 votes
–1 votes
1 is the right answer.

initial value = 1

now  when then we have   9P()

9P() will make S=0 (because only one 1 down operation will take place at a time ).
similarly, 14V() make S = 1 (because only one 1 up operation will take place at a time)
6P() makes  S= 0
8V() makes S = 1
3P() makes  S= 0
2V() makes S = 1

thus final value of s = 1

Related questions

2 votes
2 votes
1 answer
2
Warlock lord asked Jan 7, 2018
1,247 views
Say I have a Binary Semaphore S initialized to 1. Consider V() as Signal and P() as Wait. If I now invoke V(S), will it wait for S to become 0? Or will it go on with furt...
1 votes
1 votes
2 answers
3
sumit chakraborty asked Nov 26, 2017
993 views
Given Processes P1: Wait(Sx); Wait(Sy); Do something;Signal(Sx); Signal(Sy); and Process P2: Wait(Sx); Wait(Sy); Do something;Signal(Sy); Signal(Sx); . Will it ever lead ...