GATE 2008 CS – Question 63
Counting semaphore s uses P: decrement s, wait if s<0; V: increment s, wake one waiter if s≤0. Binary primitives Pb, Vb implement it as below. What initial values should xb, yb have?
P(s): Pb(xb); s=s-1;
if(s<0) { Vb(xb); Pb(yb); }
else Vb(xb);
V(s): Pb(xb); s=s+1;
if(s<=0) Vb(yb);
Vb(xb);Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) 1 and0
Explanation
We are sorry we couldn't write detailed soluition for this, we are working on it!, please consider asking your own AI, its just 2-3 clicks with very minimum effort