Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Async, Multiplexing, and Fairness

Concurrency modelMany streams, one UDP socketRevision c8b02d1

One endpoint may serve many connections, and each connection may contain many bidirectional and unidirectional streams. These lifecycles overlap without one task per packet.

Endpoint and connection state are mutex-protected because application futures and runtime drivers may run on different worker threads. Critical sections call the synchronous protocol core, update waker maps, and leave quickly; .await does not occur while holding the lock.

Stream flow control bounds unconsumed bytes per stream and connection. QUIC congestion control separately bounds bytes in flight on the network. Socket buffer capacity, stream credit, connection credit, and congestion windows are different budgets and must not be collapsed into one “concurrency limit.”

The drivers cap receive/event/transmit work per poll. A self-wake requests another turn when work remains. This preserves throughput while giving the executor a scheduling boundary.

Parallelism comes from runtime tasks on several threads; protocol ordering remains serialized per connection under its state lock.