Table of contents of the article:
The open source software landscape is dotted with projects that aim to improve and optimize the Linux operating system in various areas. One of these, which has seen a long evolution, is the Real Time Linux (RTL) project, which has as its main objective that of ensuring the system's ability to respond to events or complete operations within predetermined time intervals. The patch that makes all this possible is called PREEMPT_RT, and the big news for 2024 is that it will finally be included in the Linux kernel mainline starting with version 6.12.
This inclusion represents a significant turning point for the project, not only for the technical implications, but also for the long journey it has had to face. After almost 20 years of debates, technical challenges, limited resources and marginal support, the Linux kernel will officially integrate a feature requested by specific industry and development niches. Let's see what Real Time Linux means exactly, why it was so difficult to integrate it into the kernel and what the future impacts will be.
What is Real Time Linux?
Before we delve into the topic of including the PREEMPT_RT patch in the Linux kernel, it is important to understand what Real Time Linux is and why it is so relevant in some areas.
Un real-time operating system (Real-Time Operating System, or RTOS) is a system designed to execute tasks within a specified time frame, ensuring that critical operations are completed reliably within specific time intervals. In other words, real-time systems are optimized to respond to events with extremely low and predictable latency.
Linux and Real Time
Linux, in its standard configuration, is not a real-time operating system. While it is great for a wide range of applications, its ability to handle critical real-time operations is limited without significant modification. This is where the PREEMPT_RT patch comes in.
PREEMPT_RT is a series of patches that modify the kernel to improve preemption (pre-emption), allowing for more accurate process management and significantly reducing system latency. Preemption, in general, is the ability to interrupt the execution of a process to allow the execution of another process with a higher priority. In the context of real-time systems, this feature is fundamental: critical operations must be performed without unexpected delays.
Without PREEMPT_RT, Linux can handle many tasks simultaneously, but it cannot guarantee that a given task will be completed in a given time. With PREEMPT_RT, however, you get a kernel configuration that guarantees exactly this, making Linux a suitable platform for critical real-time applications such as:
- Embedded systems in automobiles.
- Medical devices.
- Industrial control systems.
- Robotic applications.
Any system where delays in operations could have serious consequences, such as errors in surgical operations, malfunctions in industrial production lines, or safety issues in autonomous vehicles, can benefit from a kernel optimized for real-time.
The long road to inclusion
One of the most interesting aspects of integrating PREEMPT_RT into the Linux kernel is how long it took: almost 20 years. The Real Time Linux project started in the early 2000s, but it wasn't until the release of the Linux 6.12 kernel that the patch was finally included in the mainline.
The technical challenges
The first challenge that delayed the inclusion of PREEMPT_RT was purely technical. Although Linux is known for its modularity and ability to accommodate third-party patches, the nature of the PREEMPT_RT patch required profound changes to the kernel's internal workings. The Linux kernel is built to be generic and optimized for a wide range of uses, from servers to desktop devices to embedded systems. This generic approach, however, is not immediately compatible with the needs of real-time systems, where predictability of operation is critical.
The integration of PREEMPT_RT required a series of trade-offs and optimizations that had to be carefully considered to avoid compromising the overall performance of the kernel. The challenge was to make the patch part of the kernel without degrading the performance of non-real-time systems. The technical difficulties therefore extended the review and development times.
The initial lack of interest
Another reason why inclusion took so long is related to the politics and priorities of the Linux community. Although the PREEMPT_RT patch had clear benefits for some industrial and scientific applications, these represented a small percentage of the Linux user base. Most Linux users use the system for servers, desktops, and mobile devices, where real-time requirements are not critical.
For many years, therefore, the kernel development community focused its resources and attention on other areas, such as scalability for data centers, improving overall performance, and hardware support. Real-time requirements were not considered a priority by most developers, further slowing down the progress of PREEMPT_RT.
Limited resources and the economic factor
Another obstacle was the financial and human resources available to the project. Producing a patch of this magnitude and keeping it updated over time requires significant resources, both in terms of time and money. In the long term, the Real Time Linux project suffered from a lack of adequate funding to support a stable and sufficient development team to overcome all the technical challenges. However, thanks to the support of companies such as Intel, Red Hat, Google and others who recognized the value of Linux in real-time applications, the project was able to move forward.
The revolution with Linux Kernel 6.12
The 6.12 release of the Linux kernel finally marks the turning point. After years of discussions, fixes and tests, the PREEMPT_RT patch will be integrated into the mainline, meaning that it will be officially part of the kernel and will no longer require external patches to be used.
This is an important step not only for the Real Time Linux project, but also for the entire Linux ecosystem. Having real-time functionality directly in the mainline kernel opens up new possibilities for the development of mission-critical applications, especially in areas where Linux is not yet widely adopted.
Impacts and implications
The inclusion of PREEMPT_RT in the kernel has several implications:
- Better long-term support: With the patch integrated into the main kernel, it will be easier to keep it up to date and compatible with new kernel versions. Developers will no longer have to worry about applying and managing separate patches to achieve real-time functionality.
- Wider adoption: Companies and developers requiring real-time capabilities will be more inclined to choose Linux as the operating system for their projects, knowing that support is built-in and official.
- Benefits for the embedded and industrial worldIndustries such as industrial automation, automotive and robotics will benefit from a Linux kernel with real-time support, improving the reliability and performance of their critical applications.
- Potential Side Effects for Desktops: Although PREEMPT_RT is primarily intended for embedded systems and specialized applications, its inclusion in the mainline kernel may have implications for desktop users as well. However, enabling it on desktop or laptop devices is not recommended, as it may lead to inefficiencies or resource management issues, as highlighted in several analyses.
Realtime predecessors like QNX
Before the inclusion of PREEMPT_RT in the Linux kernel, real-time operating systems such as QNX dominated critical sectors such as automotive, robotics and industrial automation. QNX, developed since the 80s, is renowned for its reliability and ability to handle real-time operations with precision and low latency. However, with the integration of Linux Real-Time into the kernel mainline, we could see a gradual challenge to QNX's dominance in the coming years. Linux, due to its open source nature and vast development ecosystem, could offer a more flexible and customizable alternative. While QNX remains well established, Linux, with the support of a large and dynamic development community, could gain traction and, in a few years, become a preferred solution for many companies, due to its lower costs and greater scope for innovation compared to proprietary solutions such as QNX.
Conclusions
The integration of PREEMPT_RT into the Linux 6.12 kernel marks the end of a long battle that began in the early 2000s. This development not only represents a victory for the Real Time Linux project, but also opens up new possibilities for the adoption of Linux in critical sectors that require guaranteed response times and very low latencies.
For those using Linux in general desktop or server environments, this news will not have a direct impact. However, for industries that depend on real-time applications, such as automotive, industrial automation, robotics and medical devices, this inclusion represents a milestone, positioning Linux as a more robust and competitive platform in these sectors as well.
The inclusion of real-time support in the mainline Linux kernel will probably be remembered as one of the most significant developments in the evolution of Linux, an operating system that continues to prove itself versatile and capable of adapting to the most diverse needs, from everyday use to the most critical and advanced applications.