GATEverse
← GATE CSE 2008

Q63

MCQ2 marks, −0.5

The PP and VV operations on counting semaphores, where s is a counting semaphore, are defined as follows: P(s):P(s): s=s−1;s=s-1; If s<0s < 0 then wait; V(s):V(s): s=s+1;s=s+1; If s≤0s \leq0 then wake up process waiting on s; Assume that PbP_b and VbV_b the wait and signal operations on binary semaphores are provided. Two binary semaphores xbx_b and yby_b are used to implement the semaphore operations P(s)P(s) and V(s)V(s) as follows: P(s):P(s): Pb(xb);\quad P_b(x_b); s=s−1;\quad s = s-1; if (s<0)\quad \text{if } (s<0) {\quad \{ Vb(xb);\qquad V_b(x_b); Pb(yb);\qquad P_b(y_b); }\quad \}  else Vb(xb);\quad \text{ else } V_b(x_b); V(s): V(s): Pb(xb);\quad P_b(x_b); s=s+1;\quad s= s+1; if (s≤0)Vb(yb);\quad \text{if } (s\leq0) V_b(y_b) ; Vb(xb);\quad V_b(x_b); The initial values of xbx_b and yby_b are respectively

Sign in to save attempts.

Loading…