🎓 BookMCQ
← Back to 5. Process Synchronization

📝 Resuming Processes within a Monitor in Process synchronization (36 MCQs)

Resuming Condition-Waiting Processes Inside a Monitor

Resuming processes within a monitor concerns how a waiting process regains access after another process signals its condition variable. Monitor implementations must define whether signalling transfers control immediately or merely makes the waiter eligible to resume later. These rules determine monitor occupancy, condition rechecking, and the ordering of operations between the signalling process and the awakened process.

Why Signal and Resume Semantics Affect Correctness

When a process waits on a condition variable, it temporarily releases monitor access so another process can enter and change the protected state. Once the condition is signalled, the waiting process must resume according to the monitor's scheduling semantics. If the signalling and resuming process overlap incorrectly, shared-state assumptions may become invalid.

Hoare and Mesa Monitor Signalling Behaviour

In Hoare-style semantics, signal immediately transfers monitor control to a waiting process, while the signaller temporarily waits. In Mesa-style semantics, signal makes a waiter eligible to resume later, and the signaller continues until leaving the monitor. Under Mesa semantics, wait conditions must generally be checked again in a loop.

Two Processes Competing After a Condition Signal

Suppose P1 waits because a buffer is empty and P2 later inserts an item and signals the condition. Under Hoare semantics, P1 immediately receives monitor control. Under Mesa semantics, P2 continues and may leave the monitor before P1 resumes. Another process might consume the item first, so P1 must recheck buffer availability.

Scheduling Behaviour and Condition-Variable Reliability

Clear resumption rules allow monitors to coordinate producers, consumers, and resource managers correctly. Hoare semantics simplify reasoning about the condition immediately after signalling but require direct handoff. Mesa semantics fit common scheduling systems but require condition loops because awakened processes may find the condition changed. Neither model independently guarantees starvation freedom.

Misconceptions About Resuming Monitor Waiters

'A signalled process always runs immediately' is incorrect under Mesa semantics because it becomes eligible rather than guaranteed to execute. 'A Mesa waiter can safely assume its condition remains true' is incorrect because other processes may change shared state first. 'Hoare signalling lets both processes occupy the monitor simultaneously' is incorrect because control is transferred.

Exam Focus: Comparing Monitor Resumption Semantics

Trace signal operations under Hoare and Mesa semantics and identify which process retains monitor execution. Explain signal-and-wait and signal-and-continue behaviour. Questions may examine condition loops, monitor handoff, competition after wake-up, and why a process must verify its condition before using a shared resource.

Key Terms of Monitor Resumption

  • Hoare semantics - Signalling transfers control immediately.
  • Mesa semantics - Signalling makes waiters eligible.
  • Handoff - Immediate transfer of monitor control.
  • Signaller - Process issuing condition notification.
  • Waiter - Process suspended on a condition.
  • Condition loop - Rechecks a condition after waking.
12
Easy
12
Medium
12
Hard

📝 All Resuming Processes within a Monitor in Process synchronization MCQs

Q1. Which execution rule defines Hoare-style signal-and-wait semantics?

A.Every waiter enters the monitor simultaneously after the signal.
B.The selected waiter enters the monitor immediately, while the signaling process is suspended. ✅
C.The signal is stored until a process waits in the future.
D.The signaler continues and the waiter may resume after any later monitor entry.
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Hoare semantics perform an immediate handoff. The awakened process runs while the signaler waits in the urgent queue, so only one process remains active inside the monitor at any moment.

Q2. Under Mesa-style signal-and-continue semantics, what happens immediately after a process signals a condition?

A.The waiter immediately takes ownership and suspends the signaler.
B.The monitor lock is released to every waiting process.
C.The signaler keeps executing inside the monitor, while the waiter becomes eligible to run later. ✅
D.The waiter receives a reserved copy of the resource.
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Mesa semantics do not transfer monitor ownership at the signal operation. The signaling process continues, and the awakened thread must later compete to reacquire the monitor before checking shared state.

Q3. In a Hoare-style monitor, what is the purpose of the urgent queue?

A.It holds signalers suspended during a handoff until the awakened waiter relinquishes monitor control. ✅
B.It stores threads that have not yet called any monitor procedure.
C.It allows several signalers to execute monitor code concurrently.
D.It records condition notifications for threads that arrive in the future.
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The urgent queue preserves the signaler while the selected waiter runs. When that waiter leaves the monitor or waits again, the suspended signaler can resume without competing as a new entrant.

Q4. A process calls signal on a condition variable when no process is waiting there. What normally happens?

A.The monitor creates an additional waiting process automatically.
B.The next process to wait is immediately released.
C.The condition variable permanently changes to the true state.
D.No process is awakened, and the notification leaves no stored permit for a later waiter. ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: A condition variable is a waiting queue rather than a counter. With no waiter present, signal has no lasting effect, so correctness must depend on checking the protected state predicate.

Q5. What does broadcast do to processes waiting on one monitor condition variable?

A.It transfers the monitor to all waiters at the same instant.
B.It releases the monitor lock without waking any process.
C.It selects one waiter and permanently cancels the others.
D.It makes every current waiter eligible to resume, although monitor entry remains exclusive. ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: Broadcast notifies every process currently waiting on that condition. The monitor still admits only one active process at a time, so awakened threads reacquire access separately and recheck their predicates.

Q6. Why must a Mesa-style waiter normally test its predicate again after waking?

A.Another process may enter first and change the shared state before the waiter reacquires the monitor. ✅
B.The waiter loses its program counter whenever it receives a notification.
C.The signal operation always changes the predicate back to false.
D.Mesa monitors allow multiple waiters to modify protected data simultaneously.
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A Mesa notification only makes a waiter eligible; it does not reserve the condition. A competing thread can consume the resource or alter the state before the original waiter resumes.

Q7. Why can a waiter in a classical Hoare monitor often use a single condition test before waiting?

A.The signaler and waiter execute protected code simultaneously.
B.The condition variable itself stores the resource being requested.
C.The signal operation immediately hands control to that waiter, preventing an intervening monitor process from invalidating the condition. ✅
D.Hoare monitors permanently remember every condition signal.
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Immediate handoff suspends the signaler and gives the waiter control before another entrant can change the protected state. This is why the condition is considered valid at that handoff point.

Q8. Why must a condition wait release monitor ownership while the process is blocked?

A.Another process must be able to enter the monitor and change the state that can satisfy the waiter's predicate. ✅
B.A blocked process must keep modifying the protected state while asleep.
C.Releasing ownership converts the condition variable into a counting semaphore.
D.The monitor must allow all waiters to execute together.
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A waiter that retains monitor ownership could prevent every other process from making the awaited condition true. The wait operation therefore suspends the caller and releases exclusive monitor access during the entire wait interval.

Q9. Under Mesa semantics, what does a successful signal promise to a waiting process?

A.It reserves the resource until that particular waiter consumes it.
B.It makes the waiter eligible to compete for monitor access, but does not guarantee the predicate remains true. ✅
C.It guarantees that the waiter cannot be interrupted after notification.
D.It guarantees the waiter will execute before the signaler continues.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Mesa signaling is a notification rather than a resource reservation or immediate transfer. The waiter may resume after other monitor activity, so it must verify the relevant predicate while holding the lock.

Q10. Which statement best distinguishes a condition-variable queue from a Hoare urgent queue?

A.The urgent queue stores future signals, while the condition queue stores resource counts.
B.Both queues contain only processes that have finished execution.
C.The condition queue holds processes waiting for a predicate, whereas the urgent queue holds signalers suspended by an immediate handoff. ✅
D.The condition queue is used only for processes currently executing monitor code.
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Condition queues hold processes blocked until a monitored predicate may change. A Hoare urgent queue instead holds a signaler suspended during the immediate handoff, until the awakened waiter relinquishes monitor control.

Q11. A team compares signal-and-wait with signal-and-continue and observes fewer immediate handoffs in the latter. What conclusion is justified?

A.Signal-and-continue must always have higher throughput.
B.The better choice depends on handoff cost, rechecking overhead, workload, and the required scheduling behavior. ✅
C.The observation proves that condition variables can be removed.
D.Signal-and-wait is always faster because it resumes the waiter immediately.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Immediate handoff can simplify reasoning but adds control transfers. Continuing after signaling can reduce handoffs yet cause later predicate checks and contention, so workload measurements are needed before choosing for that application.

Q12. Does choosing Hoare or Mesa semantics by itself guarantee that every waiting process eventually resumes?

A.No; either model prevents all waiting processes from resuming.
B.No; progress also depends on waiter selection, monitor scheduling, and whether processes repeatedly retain or reacquire access. ✅
C.Yes; immediate handoff guarantees every waiter a turn.
D.Yes; signal-and-continue always schedules the oldest waiter first.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The signaling discipline defines control transfer, not a complete fairness policy. Starvation freedom also requires suitable queue selection and scheduling assumptions, which neither Hoare nor Mesa semantics automatically provide in the implementation.

Q13. What should a signaler do before signaling a Hoare-style condition if the awakened process relies on a shared-state predicate?

A.Release the monitor and update the state later without synchronization.
B.Update the protected state so that the predicate is true before performing the immediate handoff. ✅
C.Make the predicate depend on a future notification instead of shared state.
D.Signal first and let the awakened process repair the predicate.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The awakened process runs immediately and reasons from the state established by the signaler. Updating the predicate before signaling gives the waiter the condition that justified the handoff at the moment of resumption.

Q14. Why are while loops recommended around condition waits in systems that permit spurious wakeups?

A.Spurious wakeups mean the monitor lock has been permanently destroyed.
B.A while loop forces the scheduler to wake every process.
C.A wait can return without a useful notification, so the predicate must be tested again before protected work proceeds. ✅
D.A while loop stores notifications until the predicate changes.
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Some condition-wait implementations permit a thread to return without a matching signal. Rechecking the predicate in a loop prevents the thread from proceeding merely because the wait call returned under the monitor lock.

Q15. Process A signals process B on a condition in a Hoare monitor. Which process executes monitor code immediately after the signal?

A.A newly arriving process always enters before B.
B.Processes A and B execute simultaneously inside the monitor.
C.Process A continues until it exits the monitor.
D.Process B executes immediately, while process A waits on the urgent queue. ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: Hoare signal-and-wait semantics transfer exclusive monitor control to the selected waiter immediately. The signaler is suspended in the urgent queue and resumes after the waiter leaves or blocks to preserve exclusive access.

Q16. A Mesa monitor's process P signals waiting process Q. What can P do before Q next executes monitor code?

A.P must suspend immediately and give Q the lock.
B.P and Q may both update the monitor's shared data concurrently.
C.P must terminate before Q can become eligible.
D.P may continue its remaining monitor operations and then leave or wait, allowing Q to compete for re-entry afterward. ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: Signal-and-continue leaves ownership with P. Q becomes eligible but cannot execute protected code until the monitor is available and it successfully reacquires exclusive access to the monitor while excluding other entrants.

Q17. A buffer has one item and two consumers are waiting under Mesa semantics. One consumer is signaled, but another consumer enters first and removes the item. What should the signaled consumer do?

A.Remove an item anyway because the signal reserved it.
B.Assume the buffer count is negative and repair it after leaving.
C.Recheck the item count under the monitor lock and wait again if the buffer is empty. ✅
D.Continue without checking because the producer has already signaled.
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The notification does not reserve the item for the selected consumer. After reacquiring the monitor, that consumer must test the count again and block if the competing consumer emptied the buffer.

Q18. A process wakes from condition c, but its operation also requires predicate d. Predicate d is still false. What is the correct action?

A.Proceed because a signal on c satisfies every monitor predicate.
B.Ignore d and perform the operation outside the monitor.
C.Signal c repeatedly until d becomes true.
D.Check d while holding the monitor and wait on the condition associated with d if the requirement remains unsatisfied. ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: A notification concerns the condition associated with that wait, not every prerequisite for an operation. The process must test each required predicate under monitor protection and wait on the appropriate condition.

Q19. Eight consumers wait for a nonempty buffer. A producer inserts one item and broadcasts. Assuming no later insertion, how many consumers can successfully remove an item?

A.No consumer can proceed because broadcast does not notify waiters.
B.Exactly four consumers can remove it because broadcast wakes half the waiters.
C.All eight consumers can remove a separate copy of the item.
D.One consumer can remove the single item; the others must find the buffer empty and wait again before attempting removal. ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Broadcast changes waiter eligibility, not resource quantity. With one item, only one consumer can remove it; later entrants observe an empty buffer and must return to the condition wait under the monitor lock.

Q20. Three processes wait on the same condition variable. A signal operation is issued once. What is the normal effect?

A.The oldest process and the newest process resume together.
B.All waiters are removed from the condition queue permanently.
C.One waiting process is selected to resume, while the other two remain waiting. ✅
D.All three resume and enter the monitor at once.
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: A single signal normally makes one waiter eligible, not every process on the condition queue. The other waiters remain blocked until another signal or broadcast makes them eligible on that condition variable.

Q21. A timed condition wait expires and returns with the monitor lock reacquired. The operation should be abandoned if its predicate remains false. What should the process do?

A.Access the protected resource before reacquiring monitor ownership.
B.Inspect the timeout result and predicate while holding the lock, then abandon the request if the condition is still false. ✅
C.Assume the predicate became true when the timer expired.
D.Send a signal to itself and treat the resource as available.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Expiration reports that the waiting interval ended, not that the requested state occurred. With the monitor lock reacquired, the process can safely inspect the predicate and apply its timeout policy.

Q22. A programmer checks a predicate, releases the monitor lock, and only afterward registers the process on the condition queue. A signal can occur between those steps. What defect can result?

A.The process can miss the notification and sleep even though the predicate has already become true. ✅
B.The monitor automatically converts the missed signal into a broadcast.
C.The process enters the monitor twice and duplicates its state.
D.The signal is guaranteed to be saved until the next wait.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The gap between releasing ownership and joining the wait queue permits a lost wakeup. A correct wait operation atomically releases the lock and blocks so the signaler cannot slip through that interval.

Q23. A monitor implementation returns from wait before the caller has reacquired exclusive monitor ownership. Which diagnosis is correct?

A.The wait operation violates the monitor contract because protected code may run without ownership. ✅
B.The implementation is correct as long as the waiter was previously signaled.
C.The caller should update shared data while reacquisition is still pending.
D.The implementation only needs to make the condition variable persistent.
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The monitor protects shared data through exclusive ownership. A wait operation must reacquire that ownership before returning to protected code; otherwise another process may execute concurrently and create a race.

Q24. A monitor uses this pattern under Mesa semantics: if count equals zero, wait; then remove an item. What is the essential correction?

A.Keep the if statement but move item removal outside the monitor.
B.Replace wait with broadcast so every consumer receives an item.
C.Use a while loop that repeats the count test after every return from wait. ✅
D.Remove the condition test and always attempt removal.
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The if statement checks the predicate only before sleeping. Under Mesa scheduling or a spurious wakeup, the state may still be unsuitable when the process resumes, so a while loop is required.

Q25. A developer assumes a signal sent before any process waits will release the next process that later calls wait. What is wrong with this assumption?

A.The later process is guaranteed to resume before it blocks.
B.A condition variable automatically creates a resource reservation.
C.The earlier signal is stored permanently in the monitor entry queue.
D.Condition-variable signals are not stored as permits, so the later process must inspect the shared-state predicate before waiting. ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: A condition variable does not accumulate notifications. If no process is waiting at signal time, the event leaves no permit for a later caller, which must rely on synchronized state testing.

Q26. A monitor broadcasts to six waiters, and the implementation allows all six to execute protected statements simultaneously. Which invariant has been broken?

A.The timeout guarantee, because broadcast must cancel every timer.
B.The urgent queue order, because all waiters must execute before the signaler.
C.The condition variable's signal count, because it must equal six.
D.Mutual exclusion, because only one process may be active inside the monitor at a time. ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Broadcast makes waiters eligible; it does not grant simultaneous ownership. The monitor must serialize their re-entry one at a time after reacquiring the monitor so shared data remains protected by its mutual-exclusion guarantee.

Q27. Trace a Hoare monitor: at t0, A owns the monitor, B waits on x, and C waits to enter. At t1 A signals x; at t2 B runs; at t3 B waits on y. Who owns the monitor immediately after t3?

A.B continues despite having blocked on y.
B.A resumes from the urgent queue before C is admitted. ✅
C.A and C share ownership until B wakes again.
D.C enters because entry-queue processes always outrank signalers.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: A was suspended by the immediate handoff and placed on the urgent queue. When B waits on y, A can resume; the ordinary entrant C remains outside while the urgent signaler is pending.

Q28. Trace a Mesa buffer: t0 C1 waits with count 0; t1 producer sets count to 1 and signals C1; t2 producer continues; t3 C2 enters and removes the item; t4 C1 reacquires the monitor. What should C1 do?

A.Remove an item because the earlier signal reserved it.
B.Release the monitor permanently so C2 cannot run again.
C.Observe count equals zero and return to waiting on the not-empty condition. ✅
D.Continue as though count still equals one.
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The timeline shows that C2 changes the predicate before C1 resumes. Mesa signaling provides no reservation, so C1 must test the count after reacquiring the lock and wait again before attempting removal.

Q29. Trace a broadcast: C1, C2, and C3 wait for items; a producer inserts two items and broadcasts; C2 removes one, then C3 removes the second; C1 enters last. What is C1's correct next step?

A.Remove a third item because broadcast created one for each waiter.
B.Recheck the buffer predicate and wait again because both items have been consumed. ✅
C.Proceed using the count value that existed immediately after insertion.
D.Signal the producer and access the buffer without the monitor.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Broadcast awakens all three consumers, but the two available items are consumed before C1 enters. C1 must verify the current count under the lock and block while the buffer is empty.

Q30. A performance plot lists competing entrants and waiter-resumption delay in scheduling quanta: (0,1), (1,2), (2,3), (3,4), (4,5). What trend does the data show?

A.The observed resumption delay increases by one quantum for each additional competing entrant. ✅
B.The data shows that a signal always resumes its waiter immediately.
C.The delay decreases as more processes compete for monitor entry.
D.The delay stays constant regardless of competing entrants.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Each successive data pair increases both the number of competitors and the measured delay by one. This sample therefore shows a positive relationship between monitor-entry contention and waiter-resumption delay in the recorded runs.

Q31. A timed wait returns a timeout status, but after the process reacquires the monitor lock it finds the required predicate true. What should it do?

A.Access the resource without checking whether it is still protected.
B.Always abandon the operation because timeout status overrides the current state.
C.Wait again even though the predicate is already true.
D.Proceed according to the predicate, because the current protected state determines whether the operation can continue. ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: A timeout result describes the wait interval, not necessarily the state at the instant the lock is reacquired. The process should use the protected predicate to decide whether continuing is safe.

Q32. A monitor broadcasts after two resource units become available to four waiting processes. Under Mesa semantics, which statement is correct?

A.All four processes are guaranteed one unit because broadcast wakes them.
B.The monitor lock is removed until every waiter finishes.
C.At most two processes can consume the units; each awakened process must recheck availability after reacquiring the monitor. ✅
D.Exactly one process can consume both units because broadcast is equivalent to signal.
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Broadcast affects eligibility, not the number of available units. Processes enter serially, consume resources if the predicate allows, and any process finding no unit remaining must wait again while holding the monitor lock.

Q33. A producer sets ready to true while holding the monitor, calls signal when no waiter exists, and then exits. A consumer enters later. What should the consumer do?

A.Check ready under monitor protection and proceed if it is true, without relying on the earlier signal. ✅
B.Assume ready is false because condition signals are never retained.
C.Wait because the signal occurred before the consumer arrived.
D.Require the producer to signal repeatedly until the consumer enters.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The notification itself is not remembered, but the shared ready state remains protected and observable. A later consumer checks that predicate and can proceed when it already holds rather than waiting for a past notification.

Q34. A monitor has separate conditions for buffer-not-empty and system-shutdown. A state change sets only shutdown to true. Which notification is most appropriate?

A.Broadcast both conditions after every state change regardless of their predicates.
B.Signal the shutdown condition after updating the shutdown state inside the monitor. ✅
C.Wake the oldest process without regard to the condition it is waiting for.
D.Signal buffer-not-empty because all condition queues share one lock.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Distinct condition variables represent different predicates. Updating shutdown under monitor protection and notifying its own wait queue targets relevant waiters without needlessly waking consumers whose own buffer predicate remains false.

Q35. In a Mesa monitor, P signals Q and then waits on a different condition before leaving the procedure. When can Q next compete to resume?

A.As soon as P blocks and releases monitor ownership, Q can compete to reacquire the monitor. ✅
B.Only after P is terminated and removed from every monitor queue.
C.Immediately at the signal operation, before P executes its next statement.
D.Q cannot resume because Mesa signaling requires P to exit normally.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Mesa signaling makes Q eligible but does not transfer ownership immediately. When P later waits, it releases the monitor, allowing Q to compete for re-entry even though P has not exited its procedure.

Q36. Three Mesa consumers wait for a nonempty buffer. A producer inserts two items and broadcasts. C2 and C3 each acquire the monitor first and remove one item before C1 resumes. What is the final safe action for C1?

A.C1 finds the predicate false and waits again; only C2 and C3 complete a removal. ✅
B.C1 takes monitor ownership together with C2 and C3.
C.C1 removes a third item because it was included in the broadcast.
D.C1 proceeds using the producer's earlier count update without checking.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The two items are consumed before C1 reacquires the monitor. Since Mesa notification does not reserve a resource and the monitor remains exclusive, C1 must recheck and block again under the lock before acting.

🔗 Related Topics (MCQs)