ISRO | ISRO CS 2017 – May | Question 78
At particular time, the value of a counting semaphore is 10, it will become 7 after:
(a) 3 V operations
(b) 3 P operations
(c) 5 V operations and 2 P operations
(d) 2 V operations and 5 P operations
Which of the following option is correct?
(A) Only (b)
(C) Both (b) and (d)
(D) None of these
Explanation: P: Wait operation decrements the value of the counting semaphore by 1.
V: Signal operation increments the value of counting semaphore by 1.
Current value of the counting semaphore = 10
a) after 3 P operations, value of semaphore = 10-3 = 7
d) after 2 v operations, and 5 operations value of semaphore = 10 + 2 – 5 = 7
Hence option (C) is correct.
Quiz of this Question