Skip to main content

Checkpoint: The Pipeline

intermediate30 min readLesson 144 of 148

Prove the concurrency discipline: exact results through a bounded queue with real threads.

The task

Implement producer_body and consumer_body (see the challenge). The queue and harness are given (correct); the graded work is the choreography: producers signal completion, the consumer relies on the queue's blocking pop — and the total comes out exact: 4950 through a 4-slot pipe, then 1225, then 0 for an empty pipeline. No timing assumptions survive this test; only correct synchronization does.

Passing this proves you can wire real threads around a shared bounded resource — the pattern behind every worker pool and channel in production C.

Next module: the capstone — every module's discipline in one program.