Skip to main content

Executable bounded-queue lab

10–16 implementation hours, included in the 22–32-hour extension. Download the starter, reference, contract, checks and interleaving model. Python 3.9+ and its standard library suffice.

  1. Spend 2–3 hours writing predicates, linearization points and close/drain predictions before implementation.
  2. Run python3 -B check.py starter and preserve the expected failure. Spend 4–6 hours implementing the API; retain the _condition attribute for the supplied teaching diagnostics.
  3. Spend 2–4 hours running controlled wait/close tests and rejecting a seeded missing-notification or predicate-loop fault. Run python3 -B interleavings.py separately and explain its six schedules.
  4. Spend 2–3 hours reviewing the 100-item transfer, adding a fresh close case and documenting limits. Compare python3 -B check.py reference only after your attempt.

The checks include 243 sequential histories, explicitly skipping would-block operations in that layer. They are not 243 concurrent schedules. Separate real-thread tests observe wait boundaries with Events, inject a synthetic wake, exercise full producers and empty consumers at close, and collect worker errors. Two-second join deadlines expose stuck tests but are not API guarantees; investigate a slow-host failure rather than increasing bounds until a bug disappears.

Submit source, predictions, command output, failure/repair trace, independent shutdown case and assistance disclosure. Complete all CQ1–CQ6 gates. Original atomics, semaphores, deadlock, lock-free and async work remains required.