Skip to content
Search

RTLinux

lastmod 2024-11-20created 2024-09-257 edits

RTLinux is a hard realtime real-time operating system (RTOS) microkernel that runs the entire Linux operating system as a fully preemptive process. The hard real-time property makes it possible to control robots, data acquisition systems, manufacturing plants, and other time-sensitive instruments and machines from RTLinux applications. The design was patented. Despite the similar name, it is not related to the Real-Time Linux project of the Linux Foundation.

RTLinux was developed by Victor Yodaiken, Michael Barabanov, Cort Dougan and others at the New Mexico Institute of Mining and Technology and then as a commercial product at FSMLabs. Wind River Systems acquired FSMLabs embedded technology in February 2007 and made a version available as Wind River Real-Time Core for Wind River Linux. As of August 2011, Wind River has discontinued the Wind River Real-Time Core product line, effectively ending commercial support for the RTLinux product.

What is real-time?

Real-time literally means 'real time'. To understand exactly what real-time means in computer engineering, it helps to compare it with similar concepts such as low latency or fast response time. "Real-time" means there is a time limit, while "fast response time" means the faster, the better.

For example, suppose there are Task A and Task B. If Task A does not perform a certain function within 1 second, it can cause critical harm to the whole system. In this case the time limit is 1 second, and performing that function while meeting the 1-second deadline is called "real-time". In contrast, suppose Task B has no such time limit for performing its function. It would be nice if Task B were fast, but being slow does not cause critical damage to the system. This can be seen as a case that requires low latency or fast response time. (I didn't have a precise grasp of this either, but I remember it because a researcher from the real-time lab at Seoul National University explained it to me around May this year -_-...)

Here, the concept of real-time also splits into two: Hard RT and Soft RT. Hard RT is the case where there is a fixed time threshold and the task must be done within that time. 1 To use a slightly exaggerated analogy, think of a situation where the whole system of a nuclear power plant must be shut down. The opposite concept, Soft RT, has a fixed threshold value but means "guaranteeing real-time as much as possible" for that value. It is not a big problem if RT is not guaranteed, but it tries its best to meet the time threshold, which is somewhat similar to the "low latency" mentioned above. I don't know how the research domain distinguishes these, but since I'm not a real-time researcher.. I'd better stop explaining here.

Features

  • Realtime Linux is officially included as part of the kernel, so "real-time Linux" will now be usable without a real-time operating system (RTOS)
  • If you wanted to use "real-time Linux" for audio equipment, industrial welding lasers, Mars rovers, and so on, that option has existed for a long time (assuming you don't use alternatives such as QNX)
  • Universities started building their own real-time kernels in the late 1990s
  • A patch set called PREEMPT_RT has existed since at least 2005
  • Some aspects of real-time work, such as NO_HZ, moved into the mainline kernel long ago, making them usable in data centers, cloud computing, or anything with many CPUs

PREEMPT_RT

PREEMPT_RT was a set of patches for the Linux kernel which implement both hard and soft real-time computing capabilities. On September 20, 2024, PREEMPT_RT was fully merged and enabled in mainline Linux on the supported architectures x86, x86_64, RISC-V and ARM64. This will make kernel v6.12 the first release to include baked-in real-time capability.

PREEMPT_RT is a patch used to strengthen real-time performance in the Linux kernel. It improves the behavior of the default Linux kernel, increasing real-time responsiveness and predictability. This lets specific tasks be handled with lower latency and higher priority.

Its key features are:

  • Stronger preemptibility: with the PREEMPT_RT patch applied, preemption becomes possible on almost every code path in the kernel. This means that even if a task takes a long time, another real-time task can interrupt it and run.
  • Improved locking: the existing Linux kernel protects resources with locking techniques such as spinlocks, but PREEMPT_RT makes them preemptible so that real-time tasks are not delayed by locks.
  • Improved interrupt handling: hardware interrupts are handled as threads, so real-time tasks are less affected by interrupts and responsiveness is predictable.

PREEMPT_RT is especially useful in environments that require high real-time performance, such as industrial systems, robotics, and financial trading systems, and is used to greatly improve real-time performance on Linux.

Mainline merge of PREEMPT_RT

  • PREEMPT_RT is likely to be -> has been merged into mainline in the 6.12 kernel. See #Linux kernel 6.12 release
  • Final approval came while Linus Torvalds was attending Open Source Summit Europe
  • Torvalds wrote the original code for printk, a debugging tool that can pinpoint the exact moment a process crashes but introduces latency that runs counter to real-time computing
  • The Phoronix blog has been tracking PREEMPT_RT's progress into the kernel, along with the printk changes for threaded/atomic console support that were crucial to real-time mainlining

Impact on desktop Linux? Not much

  • Beyond high-end audio production or replication (and even that is debatable), a real-time kernel will not make windows faster or programs faster
  • However, the guaranteed execution and worst-case latency that real-time Linux provides are very useful for systems that monitor car brakes, guide CNC machines, and regulate complex multi-CPU systems
  • Including PREEMPT-RT in the mainline kernel makes maintaining real-time systems easier and removes the need to manage out-of-tree patches

Impact on specialized real-time OS solution providers

  • Ubuntu began offering a real-time version of its distribution in 2023, but it required an Ubuntu Pro subscription
  • Ubuntu offered the real-time release with fixes, patches, module integration, and testing for robotics, automation, embedded Linux, and other real-time needs
  • Things will change for the specialized real-time OS solution providers that have served mission-critical systems until now

Linus Torvalds's view

  • At the 2006 Kernel Summit, Torvalds said, "Controlling a laser with Linux is crazy, but everyone in this room is crazy in his own way"
  • He said, "If you want to use Linux to control an industrial welding laser, I have no problem with your using PREEMPT_RT"
  • About 18 years later, Torvalds, the kernel team, and Steven Rostedt, the long-time maintainer and champion of real-time, have made that kind of thing easier

GN⁺'s opinion

  • The mainline merge of real-time Linux is expected to further broaden Linux's scope and let it be used in various fields
  • Linux looks set to be used more widely, especially in industrial sites, embedded systems, and robotics where real-time behavior matters
  • However, adopting real-time Linux requires considering hardware compatibility, system stability, development difficulty, and so on
  • Existing real-time OSes such as QNX, VxWorks, and INTEGRITY are still competitive in this field, so the choice should fit the situation
  • With real-time Linux now in mainline, the development ecosystem is expected to become more active and support for diverse hardware and software to widen

Linux kernel 6.12 release

  • Linux kernel 6.12 release | GeekNews
  • Expected to be this year's LTS kernel version
  • The real-time feature "PREEMPT_RT" is finally integrated into the main kernel. An important feature completed after 20 years of development
  • Extensible scheduler support (Sched_ext): lets the kernel scheduler be extended using (e)BPF programs
  • QR code error messages in DRM Panic: QR code support added to Linux's error message feature similar to the "Blue Screen of Death"
  • Intel Xe2 Lunar Lake and Battlemage graphics enabled
  • Initial support added for next-generation Intel CPUs: Panther Lake processors and Xeon Diamond Rapids processors
  • RDNA4-related work in the AMDGPU and AMDKFD driver code
  • Intel CPU hybrid core optimization: improved hybrid CPU capacity scaling for P/E cores on next-generation processors such as Lunar Lake CPUs
  • Raspberry Pi 5 included in the mainline Linux kernel for the first time.
  • Qualcomm Snapdragon X1 laptop support: mainline kernel support added for the Lenovo ThinkPad T14s Gen 6 and Microsoft Surface Laptop 7.
  • Support for various new networking hardware

See also

Favorite site

References


  1. Blog.naver.com_-alice_k106-RTOS-RTLinux-_RT_Scheduling.pdf ↩

author Zer0 sitemap