# 20 years later, real-time Linux makes it to the kernel - really

**URL:** <https://community.tmpdir.org/t/20-years-later-real-time-linux-makes-it-to-the-kernel-really/1395>\
**Category:** Embedded Linux\
**Tags:** realtime, linux\
**Created:** [September 19, 2024, 1:21pm UTC](https://community.tmpdir.org/t/20-years-later-real-time-linux-makes-it-to-the-kernel-really/1395 "2024-09-19T13:21:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbrake](https://community.tmpdir.org/user_avatar/community.tmpdir.org/cbrake/32/3_2.png) [@cbrake](https://community.tmpdir.org/u/cbrake)\
**Post date:** [September 19, 2024, 1:21pm UTC](https://community.tmpdir.org/t/20-years-later-real-time-linux-makes-it-to-the-kernel-really/1395/1 "2024-09-19T13:21:47Z")

</div>

Some interesting background information on the Linux RT patch, the effect it has had in the past. It is interesting that Printk was the final hurdle – something so seemingly simple, yet difficult.

> **[20 years later, real-time Linux makes it to the kernel - really - ZDNET](https://www.zdnet.com/article/20-years-later-real-time-linux-makes-it-to-the-kernel-really/)**
>
> The work done on real-time Linux has benefitted the open-source OS for years, but it was only this week that Linus Torvalds admitted its last piece into the mainline kernel. Exactly what took so long?

> It turns out that a lot of musicians were early real-time Linux users because it let them produce high-quality recordings on the cheap. Who knew? Other real-time Linux features that has slipped into the mainline kernel over the years include:
> 
> - The introduction of [mutexes](https://www.geeksforgeeks.org/mutex-lock-for-linux-thread-synchronization/)
> - [Ftrace](https://www.kernel.org/doc/html/v4.17/trace/ftrace.html), arguably the most important Linux debugging tool
> - [Priority inheritance](https://www.opensourceforu.com/2019/04/how-to-avoid-priority-inversion-and-enable-priority-inheritance-in-linux-kernel-programming/) for user-space applications

> So, why is Real-Time Linux only now completely blessed in the kernel? “We actually would not push something up unless we thought it was ready,” Rostedt explained. “Almost everything was usually rewritten at least three times before it went into mainline because we had such a high bar for what would go in.”

> The final hurdle for full integration was reworking the kernel’s [print\_k](https://www.kernel.org/doc/html/next/core-api/printk-basics.html) function, a critical debugging tool dating back to 1991. Torvalds was particularly protective of print\_k --He wrote the original code and still uses it for debugging. However, print\_k also puts a hard delay in a Linux program whenever it’s called. That kind of slowdown is unacceptable in real-time systems.
> 
> Rostedt explained: “Print\_k has a thousand hacks to handle a thousand different situations. Whenever we modified print\_k to do something, it would break one of these cases. The thing about print\_k that’s great about debugging is you can know exactly where you were when a process crashed. When I would be hammering the system really, really hard, and the latency was mostly around maybe 30 microseconds, and then suddenly it would jump to five milliseconds.” That delay was the print\_k message.
> 
> After much work, many heated discussions, and several rejected proposals, a compromise was reached earlier this year. Torvalds is happy, the real-time Linux developers are happy, priint\_K users are happy, and, at long last, real-time Linux is real.

Another article:

> **[The realtime preemption end game — for real this time](https://lwn.net/Articles/989212/)**
>
> Work on realtime preemption for the Linux kernel got its start almost exactly 20 years ago (tho \[...\]

> With the printk bits merged, PREEMPT\_RT could be enabled on X86, ARM64 and Risc-V. These three architectures merged required changes over the years leaving me in a position where I have no essential changes in the queue that would affect them.

This again emphasizes that the MPU world is being reduced to three architectures. Anything else is not a good bet for new product development.

---

<div class="post-metadata">

**Author:** ![khem](https://community.tmpdir.org/user_avatar/community.tmpdir.org/khem/32/5_2.png) [@khem](https://community.tmpdir.org/u/khem)\
**Post date:** [September 19, 2024, 5:10pm UTC](https://community.tmpdir.org/t/20-years-later-real-time-linux-makes-it-to-the-kernel-really/1395/2 "2024-09-19T17:10:23Z")

</div>

yeah it amazes me that how it survived this many years, I use to cite the example of overlayfs for long standing out of tree pieces which finally made it, so another one adds to list 🙂
