Real-Time Linux with PREEMPT_RT
If your device is to meet fixed deadlines with Linux, we establish whether that is achievable on your hardware. If a running system misses its deadline, we find the cause. We assign every measure to the kernel, the system configuration or the application.
Fixed-price entry point:
What we do for real-time Linux
We support real-time projects from the question of whether Linux can meet your deadlines to a system that meets them in the field. This includes:
- assessing feasibility from deadlines, acceptable jitter, cycle times and what a missed deadline costs, weighed against SoC, board and the planned software architecture
- choosing the route between a standard kernel with
PREEMPT,PREEMPT_RT, isolated cores or a split with a microcontroller core - measurements with
cyclictestunder field-like load and for long enough, and the analysis of outliers withftrace - configuring the system with CPU isolation, interrupt affinity, and frequency and power management
- reviewing the application for scheduling class and priority, locked memory, and allocations and blocking calls in the control path
- the RT kernel in the Yocto BSP and latency runs as a regression test on real hardware
Where latency comes from
An RT kernel alone is not enough, because PREEMPT_RT only concerns the kernel. The worst-case latency is also decided by the system configuration, the application and the hardware.
A system is real-time capable if it meets a deadline even in the worst case. It is about predictability, not speed. PREEMPT_RT makes almost the whole kernel preemptible for that, using threaded interrupts, sleeping locks, priority inheritance and high-resolution timers. That is about half the work. The other half lies in the system configuration and in the application, and that is where the microseconds gained are most often lost again, for instance to deep CPU sleep states, to interrupts from unimportant devices on the time-critical core, or to a page fault or an allocation in the control path. Beneath that sits the hardware. On x86, for example, System Management Interrupts can halt the kernel unnoticed, so even the choice of platform is a decision about real-time capability.
How we measure latency
We measure under the load that also occurs in the field, for long enough, and evaluate the maximum rather than the mean.
A controller that serves 999,999 cycles in 50 microseconds and takes 8 milliseconds on the millionth has an excellent average latency and is still useless if its deadline is 200 microseconds. That is why we measure with cyclictest alongside network traffic, writes to flash, graphics output and fieldbus. The runs last hours rather than minutes, because it is the rare outliers that cause problems in the field. When one shows up, ftrace records what caused it. Once the product goes into maintenance, such runs serve as a regression test and belong in automated verification on real hardware. The article on hardware-in-the-loop testing describes what that looks like.
When Linux is not enough
Linux is not the right choice for deadlines in the single-digit microsecond range, for strictly cyclic control in the high kilohertz range, and for evidence obligations that demand a small, certifiable code base.
In these cases a split of the tasks usually helps. Many modern SoCs carry a microcontroller core next to the application cores; it takes the hard control loop while Linux serves the user interface, networking and data handling. The microcontroller core then meets the hard deadlines, and a full operating system is available for all other tasks. For devices whose deadlines lie in the range of several milliseconds, on the other hand, the PREEMPT preemption model is often enough. It is worth testing that first before switching to PREEMPT_RT. Which route fits your device is what the real-time feasibility check settles before the architecture is fixed.
Using PREEMPT_RT in a product
Since Linux 6.12, PREEMPT_RT is a configuration option in mainline and no longer a patch series you have to carry along. The effort therefore lies less in switching it on than in the validation afterwards.
In a Yocto-based setup, the RT kernel is usually a matter of choosing the kernel in the BSP. Many layers ship an RT variant, so recipes and configuration stay as they are. Drivers that were inconspicuous under the standard kernel can stand out under RT because they stay too long in non-preemptible sections. The measurement under load finds such cases. The platform beneath, with bootloader, kernel, device tree and drivers, is part of our Embedded Linux development, and the application’s real-time threads are part of our C++ development.
How we work together
You can start with one of two fixed-price packages or commission an individual project directly.
If the architecture is not yet fixed, the real-time feasibility check answers whether your deadlines can be met with Linux and by which route. If the system is already running and misses its deadline, the real-time Linux review analyses the measurements your team takes on the device following our instructions. Neither package needs your hardware on our desk, and both end in an estimate for the next step. Larger or different undertakings, such as implementing the measures, measurements by us on your hardware or an architecture with a microcontroller core, we quote individually. We work remote-first, wherever your team is based, and on site when needed, in German and in English. The technical background is covered in detail in the article Real-Time Linux: What PREEMPT_RT Delivers.
Real-time feasibility check
Before the architecture is fixed, we establish whether your deadlines can be met with Linux and by which route.
If you need a solid basis before starting a project, you can begin with this package. Price and result are fixed in advance.
Scope of work
- Capturing the requirements with your team: deadlines, acceptable jitter, cycle times and what a missed deadline costs
- Assessment of SoC, board and planned software architecture for latency sources such as power management, firmware interruptions and interrupt load
- Weighing the routes: a standard kernel with PREEMPT, PREEMPT_RT, isolated cores, or a split with a microcontroller core
- Closing session with your team
Result
- A reasoned recommendation for the route, with the risks that speak against it
- A measurement plan to confirm the recommendation on the target hardware: load, duration, criteria
- A rough estimate for implementing the recommended route
One device and its real-time requirements. We assess from your documents and information. This package involves no measurements.
Not included
- Measurements on your hardware, which the real-time Linux review analyses
- Evidence for functional safety or a certification
- The implementation
Real-time Linux review
If your system runs PREEMPT_RT but its latencies miss the deadline, we analyse the causes based on your own measurements on the target hardware.
If you need a solid basis before starting a project, you can begin with this package. Price and result are fixed in advance.
Scope of work
- Measurement instructions from us, following which your team runs cyclictest under field-like load on the device and records kernel configuration, boot parameters and interrupt assignment
- Analysis of kernel and system configuration: preemption model, CPU isolation, interrupt affinity, frequency and power management
- Review of your application's real-time threads: scheduling class and priority, locked memory, allocations and blocking calls in the control path
- Closing session with your team
Result
- A prioritised list of measures, each pinned to the configuration or the code, with a rough effort
- An assessment of whether the deadline is reachable with these measures or a split onto a microcontroller core becomes necessary
One device with its kernel and the real-time threads of one application. Your hardware stays with you. We work with the data your team collects following our instructions.
Not included
- Implementing the measures
- Measurements on your hardware by us, for which we make you an individual offer
Frequently asked questions
- Is Linux with PREEMPT_RT a real-time operating system?
- It is an operating system that becomes deterministic enough for many control tasks. Whether that suffices depends on your deadline: for requirements of a few microseconds, or under strict certification obligations, a dedicated microcontroller alongside the application processor is the better choice. For cycle times from a few hundred microseconds to milliseconds, Linux with PREEMPT_RT is well suited.
- What latency can we expect?
- That depends on the hardware, not on the kernel alone. Only a measurement on the target system under realistic load is meaningful, typically for hours with cyclictest, alongside network, storage and graphics load. What matters is the measured maximum, not the average.
- Do you need our hardware for this?
- Not for the two entry packages. The real-time feasibility check assesses from your documents and information and ends with a measurement plan. In the real-time Linux review, your team runs our measurement instructions on the device and we analyse the data. Your hardware stays with you. If you want us to measure on your hardware ourselves, we make you an individual offer for it.
- Does PREEMPT_RT cost processing power?
- Yes. Threaded interrupts, finer-grained locks and more context switches noticeably lower overall throughput while they narrow the spread of response times. You improve the worst case and accept a worse average in return. Where throughput matters, a standard kernel is the better choice.
Articles on this topic
In our blog we describe how we work and what matters in practice.
Real-Time Linux: What PREEMPT_RT Delivers and What It Does Not
How PREEMPT_RT makes Linux deterministic and real-time capable, how to measure latency credibly with cyclictest, and which system and application mistakes undo the tuning.
- Real-Time
- PREEMPT_RT
- Embedded Linux
Modern C++ (17/20/23) for Embedded Systems
How C++17, C++20 and C++23 make embedded software safer and clearer at little to no runtime cost, and what to keep in mind on constrained targets.
- C++
- Modern C++
- Embedded
Hardware-in-the-Loop Testing: CI/CD With Real Embedded Hardware
How hardware-in-the-loop testing extends CI/CD to embedded devices and catches driver, timing and integration bugs on the real target hardware.
- Testing
- CI/CD
- Hardware-in-the-Loop
Related services
Embedded Linux
We build Embedded Linux systems from board bring-up to application, with particular attention to stability, boot time and long-term maintainability.
Learn more →Technical Consulting
We support you with architecture reviews, technology decisions and code audits and bring 20 years of experience to your team.
Learn more →Yocto BSP & Distributions
We use the Yocto Project to build Linux distributions for your product, with custom layers and recipes, reproducible CI builds and a maintainable update path.
Learn more →Embedded Testrack
We integrate your embedded systems into an automated test rack for CI/CD on real hardware. Every release is tested around the clock through the actual input and output interfaces, without simulated mockups.
Learn more →Let's talk about your project
Get in touch if you are developing a new product, want to modernize an existing application or your team has a bottleneck.
Start a project