1,297 views
1 1 vote

1 Answer

–1 –1 vote
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
Position:
Show:

Related questions

2 2 votes
2 2 answers
160
160 views
GO Classes asked Jul 29
160 views
Two semaphores are initialized as:$S = 1$$T = 0$Two processes execute repeatedly:Process P$\texttt{wait(S);}$$\texttt{print("A");}$$\texttt{signal(T);}$Process Q$\texttt{...
2 2 votes
1 answers 1 answer
864
864 views
subhashchaganti asked Sep 21, 2022
864 views
Say there is a Binary semaphore R, initialized to 0. Say process X and Y are working on R.At T1 :- X has performed P(R); X gets blocked and gets added in Process Queue.At...
2 2 votes
1 1 answer
2.0k
2.0k views
Warlock lord asked Jan 7, 2018
1,956 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...