Examples

Every runnable example in this repo, mapped to the chapter it supports.

Every technique chapter in this guide ships one runnable example under examples/ in the repo, measured against the same parcel sortation line, and the first appendices add their own. This page fills in one row per example as each chapter lands. See the iteration plan for the order chapters ship in.

Example What it shows Chapter
00-running-example The parcel sortation line and the measurement harness; the uncorrected scan-to-divert baseline every later chapter compares against The running example and the harness
01-latency-as-a-distribution A loaded scan stage (real decode cost plus a periodic stall); the same run measured naively and with coordinated-omission correction, mean shown next to the percentiles Latency as a distribution
02-latency-budget The per-stage decomposition of scan-to-divert, with Little’s Law and Amdahl’s Law computed as planning models from the measured run The latency budget
03-eliminating-work The scan decode path before and after: per-parcel allocation, a hash-map lookup, and a rebuild replaced by a precomputed divert table with O(1) resolution Eliminating work
04-zero-copy-layout The recent-scan ledger as a pointer ring versus a contiguous hot-field array, and two counters sharing a cache line versus split onto their own Zero-copy data layout
05-wait-free-sync The scan-to-divert handoff as a mutex-guarded queue versus a wait-free SPSC ring, with an idiomatic Rust lane showing the compile-time safety guarantee Wait-free synchronization
06-exploiting-concurrency A batch sort decision fanned out sequentially, data-parallel, and task-parallel against a fixed scan-to-divert deadline, with an idiomatic Rust lane showing the data-parallel split as a compiler-checked disjoint borrow Exploiting concurrency
07-caching A barcode-to-route cache in front of a slow backing resolver, measured uncached and across LRU/LFU/FIFO/SIEVE on the same skewed trace, plus TTL staleness across a simulated reroute and a memoized pure dimension classifier Caching
08-shard-per-core An in-flight parcel tracker measured as one shared map behind one lock versus shard-per-core with direct hash routing, then the sharded design again under induced hot-key skew before and after a routing-table rebalance Shard-per-core partitioning
09-async-processing The scan-to-divert hot path’s audit write, synchronous-inline versus handed off to a background event-loop consumer (epoll, batching, a buffer pool, bounded backpressure), plus a backpressure-shedding demo and an idiomatic Rust lane built on async/await and the smol executor Asynchronous processing
10-taming-the-host The scan-to-divert hot path run against a background noise load inside a throwaway KVM guest, untuned against CPU isolation, pinning, SCHED_FIFO scheduling, and memory locking applied individually and combined, plus a cyclictest before/after of the guest’s own scheduling latency Taming the host
12-inter-vm-ipc A parcel-handoff round trip measured between two throwaway KVM guests over three transports, a shared ivshmem region, a vsock socket, and a shared virtio-fs directory, as a latency ladder spanning three orders of magnitude Appendix A: sharing memory between virtual machines
13-rdma-remote-memory A one-sided RDMA write proven over software RoCE between two throwaway KVM guests: the client writes straight into the server’s registered buffer by rkey, and the server verifies the bytes with its CPU uninvolved in the transfer (correctness only, no latency) Appendix B: remote memory across hosts
14-openshift-virt-rdma The same soft-RoCE RDMA transfer, run between two KubeVirt virtual machines on single-node OpenShift Local (CRC): bridge binding on the pod network gives each VM a reachable IP, and the same C++23 one-sided RDMA write as Appendix B moves data VM to VM (correctness only, no latency) Appendix C: the RDMA architecture on OpenShift Virtualization