5 ms·
Intel energizes decades-old real-time Linux kernel project
- snvzz 5y agoPREEMPT_RT badly needs mainlining.
- oscargrouch 5y agoIs RT Linux a good (or at least a good enough) option for realtime OS's compared to others who where designed as RT kernels from the start?
- GeorgeTirebiter 5y agoYou really have to define 'good enough'. E.g. Can handle 1000 Hz interrupt rate, and the time from firing of the interrupt timer to the time your first instruction executes is xxx microseconds. (this is important if you are doing e.g. velocity estimates from position information -- you need accurate 'dt'; therefore this time should be minimized. There are other ways to deal with jitter, but minimizing this is best.) I turned BSD 4.3 unix into RT on a VAX 780 by using an external KW-11P clock on highest priority interrupt, have the RT code run in the kernel, and otherwise, timesharing was still going while we were running the robot -- although it was pretty sloooow. There was a big memory pool in kernel space that stored robot variables, so when the robot fell over, we would press a button which would 'freeze' the circular buffer, and then the user-space code would do an ioctl() to receive a copy of that memory pool (it was too hard to share the same pool between kernel / user space -- or maybe I was too lazy, and the solution found was 'good enough' ;-) ) You can see this in action here: https://youtu.be/mG_ZKXo6Rlg?t=34 https://youtu.be/mG_ZKXo6Rlg?t=34 yes, I'm sitting 'driving' the bot.
- marcodiego 5y agoThere are options. None with even close the mindshare that linux has.
- snvzz 5y ago>None with even close the mindshare that linux has. When you have a hammer (Linux) in your hand, every problem looks like a nail. seL4 can do hard realtime, with formal proofs of worst case. Linux can't, and won't ever be able to, due to its complexity (Millions of LoCs).
- bdavis__ 5y agoRedHat has a realtime kernel. it is available from the mirrors. Currently also available from CentOS. last time i checked, it would not load the NVIDIA driver. YMMV. if you are in the < 120hz range, then it will probably work fine for most non safety critical times.
- snvzz 5y ago>Is RT Linux a good (or at least a good enough) option for realtime OS's Soft realtime, yes. It does keep scheduling latency under control, enabling e.g. pro audio with low latency (very small buffer). This is unlike without PREEMPT_RT, where with buffers under 20ms XRUNs happen frequently. Hard realtime, no. It can't guarantee a thing, as the kernel is complicated (has millions of lines of code) and thus unpredictable. Look at seL4 instead if your deadlines are hard. It has been designed for realtime, and comes with formal proofs of worst case execution time.
- zokier 5y agoI was under the impression that PREEMPT_RT in being merged into mainline piece by piece already. If you look at the patches, 4.4-rt patch is 987864 bytes in size while 5.15-rt patch is only 369182 bytes. So, crudely estimating 2/3rds of -rt has already been merged to mainline between 4.4 and 5.15. https://wiki.linuxfoundation.org/realtime/rtl/blog https://wiki.linuxfoundation.org/realtime/rtl/blog
- wyldfire 5y agoI'm a big Linux fan so having realtime support in Linux would be great. But in the absence of that, Zephyr RTOS is another great open source option with some Linux kernel inspiration. [1] https://www.zephyrproject.org/ https://www.zephyrproject.org/
- bipson 5y agoZephyr has nothing to do with the Linux Kernel -- especially from a technical standpoint. It is a project that is under the umbrella of the Linux Foundation, that's all.
- wyldfire 5y agoSorry I didn't mean to suggest that its design took inspiration from the kernel. but adjacent features like Kconfig it does.
- elcritch 5y agoMuch of the core kernel elements definitely follow Linux kernel conventions as well. For example the `eventfd` api was copied from Linux and is quite handy. The POSIX compatibility layer constants match those in Linux, etc. The style guide is also borrowed from Linux.
- joezydeco 5y agoAnd then there is stuff in Zephyr like Devicetree, which is designed to look familiar to Linux users but operates in a completely different and broken manner.
- joezydeco 5y agoAh, Zephyr. Another project that Intel had and then let go. Intel is on my list, alongside Google, under the category of "companies that do one great thing, everything else is a disposable experiment that is probably already cancelled". Proceed at your own peril with the Linutronix stuff.
- dvh 5y agoWhat was the name of that anesthesiologist who about decade ago did a lot of work in desktop UI latency in Linux kernel? How did it went? Was any of it integrated to mainline kernel?
- kryptiskt 5y agoThat's Con Kolivas. It wasn't merged, he maintained patches out of tree until recently[0]. A pity as latency doesn't seem like a high priority for Linux. Strictly speaking a real-time OS isn't about that though, that's about bounded latency, not low latency. [0] http://ck-hack.blogspot.com/2021/08/514-and-future-of-muqss-and-ck-once.html http://ck-hack.blogspot.com/2021/08/514-and-future-of-muqss-...
- nitrogen 5y agohttps://en.m.wikipedia.org/wiki/Con_Kolivas https://en.m.wikipedia.org/wiki/Con_Kolivas Nothing was merged, and last time I tried the nvidia driver didn't work with his scheduler. It's a shame, because BFS was the snappiest desktop experience I've had on Linux.
- userbinator 5y agoanesthesiologist I remember quite a few small utilities and sites I've seen over the years were written by anesthesiologists, not career software developers. I wonder why.
- marcodiego 5y ago
- bipson 5y agoThere are a lot of misunderstandings and shallow information in the article (and in the comments). I used the RT_PREEMPT patches in 2012/13, so my insight is most certainly rusty, dated and might even be wrong here or there. But still: First of all, RT_PREEMPT is about realtime as in "hard realtime" for control systems. This has nothing to do with "small latency" (the cycle time could be minutes), but with deadline guarantees, allowing control loops over (realtime) network protocols, etc. Then, almost all important additions of the RT_PREEMPT patches were mainlined one after the other. The last bits were never mainlined although essential for full preemptive kernel AFAIR, but: Most "modern" (>15 years) OTS-platform (x86, x86-64) is increasingly unfit for realtime - no matter what kernel/OS you use, because your CPU is not in control. Beginning with DMA, later also "management engines", modern platforms might dethrone your CPU on the lowest ring entirely and for as long as they want, to serve a request/interrupt, e.g. fan control, while your CPU wakes up 500ms later realizing that it missed quite a few deadlines. (Fan control is a bad example, but DMA is not. Also Intel ME!) This makes almost all Linux PCs inherently unable to reliably keep these guarantees. This puts the whole "hard realtime on Linux"-project in a pickle - since it requires full control over the platform. And most shops that go this route, will take the small additional step of using something well tested and with vendor support. And the rest buys platform and OS with support from a trusted vendor.
- CobaltFire 5y agoThis hits on the core of why we still use what we do in military aerospace. COTS stuff just can’t hit the requirements nowadays. Personally the newest X86 I’ve seen in this type of stuff was an 80286; everything newer has been POWER or SPARC of one flavor or another, typically running VXWORKS. I haven’t by any means seen everything though.
- ensan 5y agoActually, RedHawk Linux is widely used in the US “defense” industry. It supports modern hardware and even provides real-time performance when using CUDA. It is not exactly the PREEMPT_RT though. https://concurrent-rt.com/products/software/redhawk-linux/ https://concurrent-rt.com/products/software/redhawk-linux/
- jonititan 5y agoNuttx is an RTOS that sees a lot of use for drones and other control systems. https://nuttx.apache.org/ https://nuttx.apache.org/ Posix compliant and similar feel to Linux.
- pjmlp 5y agoIt is also used as microkernel for Meadow boards running .NET.
- pinewurst 5y agoThere's a general misunderstanding that RT_PREEMPT somehow lowers latency. This is not at all true as RT_PREEMPT is about assured determinism not latency. Non-RT Linux has demonstrably lower latency but not determinism: response times can be very spiky (sometimes fast - often faster than RT, sometimes very slow).