At a particular time of computation, the value of a counting semaphore is 10. Then 12 P operations and “x” V operations were performed on this semaphore. If the final value of semaphore is 7, x will be:
Explanation: Intially the value of a counting semaphore is 10 Now 12 P operation are performed.
Now counting semaphore value = -2
“x” V operations were performed on this semaphore and final value of counting semaphore = 7
i.e x + (-2) = 7
x = 9.
So, option (C) is correct.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.