Real-Time Systems, Latency, and Jitter
A control loop must run on time, every time. On an ordinary operating system, other programs, interrupts, and memory management can delay a loop by milliseconds now and then, which is called jitter. A real-time system, such as Linux with the PREEMPT_RT patch, gives guaranteed worst-case timing. For a fast controller, the occasional late cycle matters more than the average.
Latency and jitter
A loop meant to run every \(T = 1\) ms actually starts at \(t_k = kT + \delta_k\). Latency is how late a cycle starts, and jitter is how much that varies. What breaks controllers is the tail: a cycle that runs many times late. Real-time systems are judged by the worst case, not the average:
What to notice
On the standard system, most cycles are on time, so the average looks fine, but the histogram has a long tail of late cycles, and heavy background load makes it worse. Each late cycle holds an old command, and the balancing pendulum gets a kick. The real-time system's histogram is narrow, deadlines are almost never missed, and the pendulum stays calm. ROS 2 controllers, through ros2_control, are typically run on a real-time kernel for this reason, while perception and planning run normally.