4,749 views
3 votes
3 votes
2. Assume that ‘C’ is a Counting Semaphore initialized to value ‘10’. Consider the following
program segment:
P(C); V(C); P(C); P(C); P(C); V(C); V(C)
V(C); V(C); V(C); P(C); V(C); V(C); P(C)
What is the value of C?

a) 8                       b)10

c)12                      d)14

1 Answer

Best answer
3 votes
3 votes
C=10

there are 6 wait and 8 signal operation

wait operation reduce count by 1 and signal increase count by 1 in general

 so 10-6+8=12
selected by

Related questions

0 votes
0 votes
1 answer
2
Mrityudoot asked Jan 27
178 views
Can a counting semaphore acquire a negative value?S = 2;15 P operations done, should the semaphore be 0 or -13
1 votes
1 votes
1 answer
3
0 votes
0 votes
1 answer
4
Na462 asked Jul 19, 2018
546 views