Bounded Concurrency in Go: Admission Control, Cancellation, and Shutdown
A small admission gate makes overload and shutdown explicit. Follow the lifecycle from acquiring a slot to proving that every worker has finished.
Engineering notes
The notebook
Working through systems, one implementation at a time. Explanations, experiments, and the details that change the outcome.
Start the six-part engineering series ↗
18 articles · Page 1 of 3
A small admission gate makes overload and shutdown explicit. Follow the lifecycle from acquiring a slot to proving that every worker has finished.
An agent is a state machine around unreliable boundaries. Build a deterministic loop that makes tool identity, errors, cancellation, and termination inspectable.
Bound the queue and the number of tasks, preserve result identity, and make failures cancel the work they own. A standard-library asyncio lab.
Separate first-event latency, inter-event gaps, completion time, and failures. Build a small measurement tool whose arithmetic can be checked against known timelines.
Implement causal attention on CPU, trace every tensor dimension, and test outputs and gradients against PyTorch before reasoning about performance.
Compare full-prefix and incremental decoding in the same CPU model. Verify positions, logits, cache growth, and measurement boundaries before claiming a speedup.
Wire can explain an existing initialization graph, but its archived status changes the decision for new projects. Start with constructors, cleanup, and explicit ownership.
Separate atomicity, durability, and isolation, then use concrete concurrent schedules to understand what a transaction does—and what it does not guarantee.