PREEMPT_RT is a maintained set of patches for the mainline Linux kernel that converts it into a fully preemptible real-time operating system (RTOS). Unlike the standard kernel, which can only preempt user-space tasks, the CONFIG_PREEMPT_RT configuration forces the kernel to become preemptible at almost every code point, including within critical sections protected by spinlocks. This is achieved by converting most spinlocks into mutexes that support priority inheritance, ensuring that a high-priority real-time task can immediately interrupt a lower-priority kernel thread to meet its deterministic deadline.
Glossary
PREEMPT_RT

What is PREEMPT_RT?
PREEMPT_RT is a set of kernel patches that transforms the standard Linux operating system into a fully preemptible, hard real-time operating system capable of deterministic scheduling with microsecond-level latency guarantees.
The primary mechanism involves replacing non-preemptible spinlock critical sections with preemptible rt_mutex-based locking, which allows the scheduler to enforce strict priority ordering even during kernel operations. Interrupt handlers are also forced into kernel threads to make them schedulable entities. This transformation guarantees bounded latency for cyclictest benchmarks, making the kernel suitable for hard real-time tasks such as motion control and data acquisition. The project is critical for industrial control system virtualization, where a soft PLC or control workload must run on general-purpose hardware without jitter, enabling the consolidation of real-time and non-real-time applications on a single mixed-criticality system.
Key Features of PREEMPT_RT
The PREEMPT_RT patchset transforms the standard Linux kernel into a hard real-time operating system by making it fully preemptible. These are the core architectural mechanisms that guarantee deterministic scheduling for industrial control and mixed-criticality workloads.
Fully Preemptible Kernel
Converts the entire kernel into a preemptible entity by replacing non-preemptible spinlocks with rt_mutex constructs. This allows even kernel-space code paths to be interrupted and rescheduled, ensuring a high-priority real-time task can preempt a lower-priority kernel thread with microsecond-level determinism. Unlike the standard kernel's voluntary preemption model, PREEMPT_RT eliminates unbounded latency caused by long-running critical sections.
Threaded Interrupt Handlers
Forces all hardware interrupt service routines (ISRs) to execute as kernel threads rather than running in hard interrupt context. This mechanism:
- Prioritizes interrupts: Each IRQ thread receives a scheduling priority, allowing the system designer to prioritize a motor encoder interrupt over a network packet interrupt.
- Prevents priority inversion: A high-priority task is never blocked by a low-priority interrupt handler.
- Enables full control: Standard Linux scheduling policies (SCHED_FIFO, SCHED_RR, SCHED_DEADLINE) now govern interrupt processing.
High-Resolution Timers
Integrates the hrtimer subsystem to provide timer accuracy down to the nanosecond level, decoupled from the periodic tick granularity of the traditional jiffies-based timer wheel. This enables:
- Precise periodic task activation for control loops running at kHz frequencies.
- Deadline-aware scheduling where tasks can sleep and wake with sub-100-microsecond jitter.
- Cyclic synchronization with external events like a PLC scan cycle or a Time-Sensitive Networking (TSN) schedule.
Priority Inheritance Protocol
Implements a robust priority inheritance mechanism within the rt_mutex subsystem to prevent unbounded priority inversion. When a low-priority task holds a lock required by a high-priority task, the low-priority task temporarily inherits the high priority until it releases the lock. This is critical for mixed-criticality systems where a safety-rated control function must never be blocked by a non-critical logging daemon contending for the same shared resource.
Deterministic Memory Management
Replaces the standard kernel's demand paging and lazy page allocation with pre-faulting and memory locking capabilities. Real-time applications use mlockall() to pin all virtual memory into physical RAM, preventing page faults during the critical path. The kernel's slab allocator is also configured with real-time-aware flags to avoid unpredictable direct reclaim latency spikes during memory allocation in control loop execution.
Cyclictest Latency Benchmarking
The standard validation tool for PREEMPT_RT systems is cyclictest, which measures the delta between a programmed timer wakeup and the actual thread execution time. On a well-tuned PREEMPT_RT kernel running on modern x86 or ARM64 silicon, cyclictest consistently reports maximum latencies below 10-20 microseconds even under extreme stress loads like network flooding and filesystem I/O storms, proving the kernel's hard real-time capability.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Explore the critical technical details of the PREEMPT_RT patchset, the definitive solution for transforming standard Linux into a hard real-time operating system for deterministic industrial control.
PREEMPT_RT is a set of kernel patches that transforms the Linux operating system into a fully preemptible, hard real-time operating system. It works by making in-kernel locking primitives preemptible and converting most interrupt handlers into schedulable kernel threads. The core mechanism involves replacing standard spinlocks with rt_mutex-based locks that support priority inheritance, preventing the unbounded priority inversion that destroys determinism. This allows a high-priority real-time task to preempt virtually any kernel operation, including code running in critical sections, reducing maximum scheduling latency to microsecond-level determinism on properly configured hardware.
Related Terms
Understanding PREEMPT_RT requires familiarity with the broader real-time Linux ecosystem and the architectural patterns that leverage deterministic kernel behavior.
Real-Time Hypervisor
A bare-metal virtualization platform engineered to host both real-time operating systems (like a PREEMPT_RT-patched Linux) and general-purpose operating systems on shared silicon. It guarantees microsecond-level latency for critical tasks through hardware-assisted isolation. In industrial control system virtualization, this allows a single edge server to run deterministic soft PLC logic alongside non-real-time analytics containers without mutual interference.
CPU Pinning
The technique of binding a specific virtual machine or process thread exclusively to a dedicated physical processor core. When combined with PREEMPT_RT, CPU pinning eliminates cache misses and scheduling jitter by preventing the kernel scheduler from migrating latency-sensitive control tasks. This is a foundational practice for achieving deterministic execution in virtualized PLC environments where control loops must complete within strict cycle time budgets.
Time-Sensitive Networking (TSN)
A set of IEEE 802.1 Ethernet standards that guarantee deterministic, low-latency data delivery over converged networks. TSN uses precise time synchronization and traffic scheduling to ensure control frames arrive within microseconds. PREEMPT_RT and TSN are complementary: the kernel handles computational determinism while TSN guarantees network determinism, together enabling closed-loop control across distributed virtualized controllers.
Mixed-Criticality System
A consolidated computing architecture where safety-critical control functions and non-critical edge applications execute on a single hardware platform. PREEMPT_RT provides the temporal isolation required to ensure that a runaway analytics process cannot starve a safety-rated control loop of CPU time. This architecture relies on strict spatial and temporal partitioning to achieve mixed-criticality certification under standards like IEC 61508.
Precision Time Protocol (PTP)
A network protocol defined by IEEE 1588 that synchronizes distributed clocks to sub-microsecond accuracy. PREEMPT_RT kernels often serve as PTP grandmasters or boundary clocks in industrial settings because the fully preemptible kernel can timestamp network packets with extreme precision. This synchronization is essential for coordinating motion control and isochronous cycles across virtualized controllers on separate physical hosts.
Workload Consolidation
The strategy of merging multiple discrete control, HMI, and analytics functions onto a single high-performance edge server. PREEMPT_RT is the enabling kernel technology that allows a general-purpose Linux OS to simultaneously host soft PLC runtimes, protocol translators, and local databases while still meeting hard real-time deadlines. This reduces hardware footprint, cabling, and energy consumption on the factory floor.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us