Archived legacy site - a preserved snapshot of robobus before the site overhaul, no longer maintained. Go to the current site →

Forcing the tail to ~100%: hardware & firmware workarounds

docs/REALTIME.md bounds the scheduler tail. This document goes deeper, the exotic hardware/firmware tricks that attack the last 0.2% of µs outliers, so the native poller approaches a guaranteed ns-scale worst case. The outliers come from four independent layers; you have to beat all four. The robobus ring is already OS-bypass (userspace busy-poll over mmap'd shared memory, zero syscalls in the hot loop), so what's left is memory, CPU-state, and firmware jitter.

Layer Source of the outlier The workaround Ceiling
1. OS preemption scheduler, IRQs, RCU, timer tick isolated core + PREEMPT_RT (REALTIME.md) hard bound (Linux)
2. Memory / cache DRAM refresh, LLC eviction, TLB miss cache pseudo-lock, hedged channels, huge pages near-eliminated
3. CPU state C-state wake-up, freq/turbo, SMT idle=poll, perf governor, UMWAIT/WFE ns-scale
4. Firmware SMIs (invisible to the OS) detect + BIOS suppression platform-dependent

Layer 2, the memory/DRAM tail (the deepest tricks)

Even with a core to yourself, a memory read can stall for hundreds of ns to µs when the DRAM row is mid-refresh or the line was evicted from LLC. Two ways to beat it:

(a) Intel Cache Pseudo-Locking (CAT / RDT / resctrl), never touch DRAM

Intel Cache Allocation Technology + Linux resctrl can pin a memory region into L2/L3 so it is never evicted by any other core/thread, every access is a cache hit, deterministic, and DRAM refresh becomes irrelevant. Load the ring into a pseudo-locked region and the poll loop runs entirely from cache. [Intel: Introducing Cache Pseudo-Locking], [kernel resctrl.rst]. Setup (model-specific, needs cat_l2/cat_l3 in /proc/cpuinfo): see scripts/cache_pseudolock.sh. Caveat: only some Intel SKUs expose it; not on AMD/ARM/Apple.

(b) "TailSlayer", hedge across independent DRAM channels (works everywhere)

When you can't lock cache, dodge the DRAM refresh stall instead. LaurieWired's TailSlayer cut worst-case memory latency by up to 93% by duplicating the working set across memory-addressing boundaries so each copy lands on a different physical memory channel with independent refresh timing, then reading both copies on two cores and taking whichever isn't mid-refresh [Tom's Hardware]. Mapped to robobus: mirror the ring into two buffers placed a channel-stride apart (so they map to different DRAM channels/ranks), have a hedge reader on a second isolated core, and consume whichever slot resolves first. Cost: 2× memory bandwidth + a core, the "severe downside", but it directly kills the refresh-induced tail on Intel and ARM.

(c) Cheaper memory wins (always do these)

Layer 3, CPU-state jitter

Layer 4, firmware SMIs (the classic hard-RT killer)

System Management Interrupts switch the CPU into SMM to run firmware code the OS cannot see, preempt, or bound, a single SMI can stall a core for µs–ms [Linux Foundation RT wiki: SMI latency].

Also: turn off the mitigations tax (trusted RT box)

Spectre/Meltdown mitigations add overhead to every syscall/context switch/indirect branch. On a dedicated, physically-trusted RT machine, mitigations=off on the kernel cmdline removes that variable cost (a real jitter source). Only on a box where the security trade-off is acceptable.

Per-platform: how close to 100 % you can actually get

platform isolate core cache lock UMWAIT/WFE SMI-free realistic result
Linux x86 (Intel) + PREEMPT_RT yes isolcpus yes CAT pseudo-lock yes UMWAIT BIOS-dependent effectively 100 %, hard ns bound
Linux ARM64 + PREEMPT_RT yes isolcpus TCM (Cortex-R) / no yes WFE usually clean effectively 100 %
Windows affinity only no yes (x86) no soft real-time (best-effort)
macOS / Apple Silicon no (no isolcpus) no no (no user WFE hook) no (SMC) ~99.8 %, µs outliers remain
RTOS / bare-metal / FPGA N/A (no GP OS) SRAM/TCM native no SMM provable 100 %

Bottom line: a truly guaranteed 100 % is only reachable by removing the general-purpose OS from the hot path (RTOS/bare-metal/FPGA). The best you can force on a general-purpose OS is Linux + PREEMPT_RT + isolated core + cache pseudo-lock (or TailSlayer hedging) + UMWAIT/WFE + an SMI-clean BIOS, which in practice yields no observable outliers over billions of messages, "almost-guaranteed 100 %". Because the robobus wire format is OS/arch-agnostic (PROTOCOL.md), the same frames flow between that hardened core and everything else.

Adaptive: probe the hardware, apply what it supports

Because every trick here is hardware-specific, robobus detects capabilities at runtime and adapts rather than hard-coding any of them, robobus.determinism:

$ robobus determinism                     # report what THIS machine supports + recommendations
$ python -c "from robobus.determinism import optimize; print(optimize(core=3))"

capabilities() probes CPU vendor/arch, waitpkg (UMWAIT), CAT/resctrl (cache pseudo-lock), isolcpus, PREEMPT_RT, huge pages, NUMA nodes, macOS time-constraint, spare cores (TailSlayer). optimize() then applies the best available combination, pin to an isolated core if one exists, RT policy, mlockall, and returns the rest as actionable recommendations. The native poller is adaptive too: it picks the spin primitive at compile+runtime (PAUSE on x86, YIELD on ARM) and reports +umwait-capable / +wfe-capable when the CPU exposes the low-power monitor-wait.

What robobus implements vs. what is deployment/BIOS

Sources