Linux Real-Time Performance: Enabling PREEMPT_RT and Investigating Latency Spikes

Icon from www.flaticon.comTraditionally, Linux was seen as capable of handling high throughput but not ideal for workloads demanding low-latency, predictable responses in the microsecond range. That perception has changed significantly with the maturation of PREEMPT_RT, the real-time Linux patchset.

PREEMPT_RT makes the Linux kernel almost entirely preemptible (threaded interrupt handlers, sleeping spinlocks, priority inheritance, etc.) and greatly improves its determinism. Properly configured and validated on a given platform, it can achieve bounded worst-case latencies in the microsecond range.

No kernel can offer an absolute guarantee: the achievable latency still depends on the hardware, the drivers, the firmware and the configuration, which is why measuring on your own target is essential, as we discuss below. This allows Linux to meet demanding real-time constraints while retaining its rich ecosystem, hardware support, and maintainability.

The PREEMPT_RT patch has been partially merged into the mainline Linux kernel, starting from version 5.15. On September 20, 2024, with the 6.12 release, PREEMPT_RT was fully merged and made available on the supported architectures: x86, x86_64, RISC-V, and ARM64.

Continue reading “Linux Real-Time Performance: Enabling PREEMPT_RT and Investigating Latency Spikes”