Synchronization & Concurrency

Answer & solution
Answer: C (no official key was published)
1. The semaphore xb protects the shared count and must start unlocked at 1. The semaphore yb represents the waiting gate and must start at 0, so a P operation with negative count blocks.
2. Thus the required initial values are (1,0), option C. This answers the initialization question, not a proof of the whole implementation.
3. Under ordinary saturating binary-semaphore semantics the shown implementation can lose a wakeup: two P callers decrement to -2 and pause before Pb(yb); two V callers then both signal yb before either waiter consumes it, leaving only one stored signal. A robust implementation needs additional synchronization or a specified wakeup protocol.