Skip to content
Related Articles

Related Articles

ISRO | ISRO CS 2017 | Question 70

Improve Article
Save Article
Like Article
  • Last Updated : 27 Oct, 2021

A counting semaphore was initialized to 7. Then 20 P (wait) operations and x V (signal) operations were completed on this semaphore. If the final value of semaphore is 5, then the value x will be
(A) 0
(B) 13
(C) 18
(D) 5

Answer: (C)

Explanation: In semaphores, P operation means wait operation and it decrements the value of the counting semaphore by 1 whereas V operation means signal operation and it increments the value of the counting semaphore..
Here a counting semaphore S = 7
After 20 P operations , s = 7-20 = -13
After ‘x’ V operations value of S=5, So -13 + xV = 5 and S = 18 .
Option C is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!