computer science//real-time computing//jitter

Jitter is the variation of a latency or of a sampling period from one cycle to the next, and it matters because every discrete filter, estimator and controller is designed assuming its samples are equally spaced. A loop meant to run every 1 ms that actually runs after 0.9, 1.3, 0.8 and 1.0 ms has a nominal period and a jitter of a few hundred microseconds, and its mathematics is only as good as the uniform spacing it pretends to have. It is distinct from latency itself: a constant 5 ms delay can be modelled and compensated, a delay that wanders between 1 and 9 ms cannot be compensated exactly.


Jitter is the variation of a latency or of a sampling period from one cycle to the next, and it matters because every discrete filter, estimator and controller is designed assuming its samples are equally spaced. A loop meant to run every 1 ms that actually runs after 0.9, 1.3, 0.8 and 1.0 ms has a nominal period and a jitter of a few hundred microseconds, and its mathematics is only as good as the uniform spacing it pretends to have. It is distinct from latency itself: a constant 5 ms delay can be modelled and compensated, a delay that wanders between 1 and 9 ms cannot be compensated exactly.

The cost is easiest to see as measurement error. A timing error δt\delta tδt on a signal changing at rate y˙\dot yy˙​ produces a measurement error of about y˙ δt\dot y,\delta ty˙​δt: jitter is noise in the sampling instant. A drone rolling at 200 °/s whose gyro samples wander by 0.5 ms carries 0.1° of error that no sensor specification mentions. The derivative term of a PID divides by the period it assumes, so a loop woken late sees a larger difference over what it believes is the nominal step and amplifies the error; this is why a timer-driven control loop beats a while loop with sleep, whose period inherits every scheduling delay of the operating system.

Its sources are the platform's: interrupts that arrive during the task, cache misses and branch prediction that change execution time, a bus shared with other devices, an OS scheduler that wakes processes when it can (real-time computing). On a microcontroller an interrupt serves a sensor in microseconds with little variation; general-purpose Linux shows milliseconds, and PREEMPT_RT brings that to tens of microseconds.

The usual defences are structural. Trigger the loop from a hardware timer, read sensors by DMA or in their own interrupt, timestamp each measurement at acquisition (time synchronization) and let the estimator use the true instant instead of the nominal one.

It is measured the same way as the worst-case execution time: toggle a pin at the start of each cycle and watch the edges on an oscilloscope or logic analyzer for hours, reading the spread of the period, not its mean.

It enters the error budget as a sampling error: at speed vvv, a jitter of δt\delta tδt is a position error v δtv,\delta tvδt, the same form as clock offset between sensors (error budget).