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.
- Spend 2–3 hours writing predicates, linearization points and close/drain predictions before implementation.
- Run
python3 -B check.py starterand preserve the expected failure. Spend 4–6 hours implementing the API; retain the_conditionattribute for the supplied teaching diagnostics. - Spend 2–4 hours running controlled wait/close tests and rejecting a seeded missing-notification or predicate-loop fault. Run
python3 -B interleavings.pyseparately and explain its six schedules. - Spend 2–3 hours reviewing the 100-item transfer, adding a fresh close case and documenting limits. Compare
python3 -B check.py referenceonly 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.