edited by
3,971 views

3 Answers

1 votes
1 votes

Value of Counting Semaphore = 7

 20P and 15V

Resulting Value of Semaphore:

 7 - 20 + 15

 = 2

So, (3) is correct option.

0 votes
0 votes
Option(C): 2

Wait(P) decreases the count of counting semaphore and Signal(V) releases the instance i.e,increases the count of semaphore

Therefore, 7-20+15=2
0 votes
0 votes

In terms of Counting semaphore

  • wait/down/$P()$ operartion decrement $(\downarrow)$ the value by $-1$
  • signal.up/$V()$ operations increment $(\uparrow)$ the value by $+1$

Current value of CS=$7$

Final value after performing $20P$ and $15V$ operations: $(7-20P+15V)=(7-20+15)=+2$

So current value of CS is $2$

Option $(C)$ is correct.

Ref:Gate 1992

 

Answer:

Related questions

1 votes
1 votes
1 answer
1
3 votes
3 votes
3 answers
3
Arjun asked Jul 2, 2019
1,863 views
Match List-I with List-II:$$\begin{array}{|c|c|c|c|} \hline {}& \text{List-I} & {} & \text{List-II} \\ \hline (a) & \text{Disk} & (i) & \text{Thread} \\ \hline (b) & \te...