Open In App
Related Articles

ISRO | ISRO CS 2017 | Question 70

Improve Article
Improve
Save Article
Save
Like Article
Like

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

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 27 Oct, 2021
Like Article
Save Article
Previous
Next
Similar Reads