Open In App

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

Like Article
Like
Save Article
Save
Share
Report issue
Report

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


Last Updated : 28 Jul, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads