Skip to content
Related Articles
Open in App
Not now

Related Articles

GATE | GATE-CS-2016 (Set 2) | Question 59

Improve Article
Save Article
  • Last Updated : 28 Jul, 2021
Improve Article
Save Article

Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked is ________.
(A) 7
(B) 8
(C) 9
(D) 10


Answer: (A)

Explanation: 20-7 -> 13 will be in blocked state, when we perform 12 V(S) operation makes 12 more process to get chance for execution from blocked state. So one process will be left in the queue (blocked state) here i have considered that if a process is in under CS then it not get blocked by other process.

Watch GeeksforGeeks Video Explanation :



Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!