Real-Time Computing for Plasma Control
Plasma control depends on hard real-time computing, where meeting a deadline every cycle matters more than raw average throughput.
Hard versus soft real-time
In a soft real-time system, a missed deadline degrades quality but is tolerable. In a hard real-time system, a missed deadline is a failure. Plasma control is mostly hard real-time: if a stabilization command arrives after the plasma has already drifted, the correction can be wrong in sign and make the situation worse. The design target is therefore a guaranteed worst-case response time, not a good average.
Sources of jitter
Latency variation, called jitter, comes from many places: operating-system scheduling, cache misses, garbage collection, interrupt handling, and network contention. Real-time control systems remove these by pinning threads to isolated CPU cores, disabling power-saving state transitions, pre-allocating memory, and using deterministic communication protocols. Dynamic memory allocation and unbounded loops are avoided inside the control cycle.
# Control-loop skeleton with a fixed period
period_s = 0.001 # 1 kHz loop
next_tick = clock()
while discharge_active():
state = estimate_state(read_diagnostics())
cmd = controller.step(state, reference(now()))
apply(cmd)
next_tick += period_s
sleep_until(next_tick) # bounded, never busy-wait forever
Timing budget
Each cycle has a fixed budget split across acquisition, estimation, control computation, and actuation. The sum of worst-case times must fit inside the loop period with margin. Engineers profile the worst path, not the typical path, because the plasma does not care that most cycles were fast.
Redundancy
Because a hung controller is dangerous, watchdog timers monitor each loop. If a cycle overruns, the watchdog can force a known-safe output or hand control to a simpler backup controller. This graceful fallback is part of why control code is kept deliberately simple and analyzable.
For Kronos machines, the fastest loops, such as vertical stabilization of the spherical breeder plasma, sit on dedicated real-time nodes so their deadlines are never starved by slower supervisory tasks.