Multiple choice

The P and V operations on counting semaphores, where s is a counting semaphore, are defined as follows: P(s) : s = s - 1; ifs < 0 then wait; V(s) : s = s + 1; ifs <= 0 then wakeup a process waiting on s;

Assume that Pb and Vb the wait and signal operations on binary semaphores are provided. Two binary semaphores xb and yb are used to implement the semaphore operations P(s) and V(s) as follows: 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) ;

The initial values of xb and yb are respectively

  1. 0 and 0

  2. 0 and 1

  3. 1 and 0

  4. 1 and 1

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation