CS FundamentalsVery hardGATE CS

Monitors versus semaphores: in a Hoare-style monitor, when a process executes `x.signal()` and some process is waiting on condition x, which statement is correct?

  1. A. The signal is remembered like a semaphore V even if no one waits
  2. B. Both processes continue running inside the monitor together
  3. C. The signalled process runs immediately and the signaller waits; if no process waits on x, the signal has no effect
  4. D. The signaller continues and the signalled process is woken only after the monitor is empty, and the signal is remembered

Correct answer: C. The signalled process runs immediately and the signaller waits; if no process waits on x, the signal has no effect

Condition variables have no memory: a signal with no waiter is lost (unlike a semaphore V). Hoare semantics hand the monitor straight to the woken process (signal-and-wait); Mesa semantics let the signaller continue (signal-and-continue), so waiters re-check conditions in a while loop.

More Operating Systems questions

Exams that ask this topic