CONCURRENCY LAB · SCHEDULE · INSPECT · COMPARE
Producer and consumer: blocking is not dropping
Inspect bounded FIFO item identities and compare a producer that holds its item with one that drops full-queue offers.
Exact schedule state
Inspect identities, counters and transitions
Track items rather than colored occupancy
The producer creates numbered items and the consumer removes them from the head of a bounded FIFO queue. Each snapshot retains the queued identities, consumed items and any item still held by a blocked producer. This makes conservation visible: admitted items equal consumed items plus the current queue, and offered items equal admitted items plus dropped items plus a possible held item. A full queue alone does not tell you whether an implementation blocks, rejects or loses work. The selected policy determines that behavior explicitly.
Choose periods, capacity and backpressure
Producer period is the number of model ticks between new items, so a smaller value means faster production. Consumer period controls its scheduled removal attempts. Queue capacity limits only the queue, not the optional item held outside it by the producer. Hold pending item stops new production while one item waits for room; when admitted, the next production period begins at that admission tick. Drop the offered item discards a full-queue offer and continues on the original production cadence. The sixty-tick experiment uses a deterministic tie rule: consumer first, then pending admission, then a newly due offer. Changing capacity rebuilds the experiment rather than silently deleting existing items.
Make the overload policy visible
Use a producer period of one, consumer period of three and capacity five. Under blocking, the queue fills and the producer retains one pending item. Dropped remains zero, and item identities are consumed in increasing FIFO order. Switch to dropping with the same rates: offered count rises, some IDs disappear from the consumed sequence, and dropped explicitly counts them. Increase capacity and compare when overload begins; a larger buffer does not make a permanently slower consumer faster. Set the consumer period to one and producer period to eight to observe empty-queue attempts instead of producer blocking.
Read the finite run carefully
Play reveals sixty modeled ticks over sixty inspection seconds. Pause freezes it; Next state advances a tick; Restart rewinds; Speed changes inspection pace; Inspect time selects a state. Restore defaults resets the inputs. Blocked ticks count snapshots ending with a held producer item. Idle consumer opportunities count scheduled attempts that find the queue empty. The final snapshot can retain queued or pending work because the experiment stops at tick fifty-nine; those items are not falsely counted as lost. No extra drain phase is implied. This is a single-producer, single-consumer teaching schedule without thread wake-up overhead, spurious notifications, memory visibility, cancellation or a real blocking-queue library.