7 ms·
QNX had this right decades ago. The microkernel has upper bounds on everything it does. There are only a few tens of thousands of lines of microkernel code. Al
by Animats 3y ago
QNX had this right decades ago. The microkernel has upper bounds on everything it does. There are only a few tens of thousands of lines of microkernel code.
All the microkernel does is allocate memory, dispatch the CPU, and pass messages between processes. Everything else, including drivers and loggers, is in user space and can be preempted by higher priority threads.
The QNX kernel doesn't do anything with strings. No parsing, no formatting, no messages.
Linux suffers from being too bloated for real time. Millions of lines of kernel, all of which have to be made preemptable. It's the wrong architecture for real time. So it took two decades to try to fix this.
- matheusmoreira 3y agoAnd yet it's getting done! It's very impressive work.
- vacuity 3y agoFor a modern example, there's seL4. I believe it does no dynamic memory allocation. It's also formally verified for various properties. (Arguably?) its biggest contribution to kernel design is the pervasive usage of capabilities to securely but flexibly export control to userspace.
- adastra22 3y agoCapabilities are important, but I don’t think that was introduced by seL4. Mach (which underlies macOS) has the same capability-based system.
- vacuity 3y agoI didn't say seL4 introduced capabilities. However, to my knowledge, seL4 was the first kernel to show that pervasive usage of capabilities is both feasible and beneficial.
- monocasa 3y agoThe other L4s before it showed that caps are useful and can be implemented efficiently.
- vacuity 3y agohttps://dl.acm.org/doi/pdf/10.1145/2517349.2522720 https://dl.acm.org/doi/pdf/10.1145/2517349.2522720 " We took a substantially different approach with seL4; its model for managing kernel memory is seL4’s main contribution to OS design. Motivated by the desire to reason about resource usage and isolation, we subject all kernel memory to authority conveyed by capabili- ties (except for the fixed amount used by the kernel to boot up, including its strictly bounded stack). " I guess I should've said seL4 took capabilities to the extreme.
- naasking 3y agoseL4 was heavily inspired by prior capability based operating systems like EROS (now CapROS) and Coyotos. Tying all storage to capabilities was core to those designs.
- adastra22 3y agoThere's quite a history of capabilities-based research OS's that culminated in, but did not start with L4 (of which seL4 is a later variant).
- vacuity 3y agoYes, but I believe seL4 took it to the max. I may be wrong on that count, but I think seL4 is unique in that it leverages capabilities for pretty much everything except the scheduler. (There was work in that area, but it's incomplete.)
- adastra22 3y agoL4 was developed in the 90's. Operating Systems like Amoeba, which were fundamentally capability-based to a degree that even exceeds L4, were a hot research topic in the 80's. L4's contribution was speed. It was assumed that microkernels, and especially capability-based microkernels were fundamentally slower than monolithic kernels. This is why Linux (1991) is monolithic. Yet L4 (1994) was the fastest operating system in existence at the time, despite being a microkernel and capability based. It's too bad those dates aren't reversed, or we might have had a fast, capability-based, microkernel Linux :(
- _kb 3y agoAnd unfortunately had its funding dumped because it wasn’t shiny AI.
- snvzz 3y agoIts old source of funding. And it was much more complex[0] than that. seL4 is now a healthy non-profit, seL4 foundation[1]. 0. https://microkerneldude.org/2022/02/17/a-story-of-betrayal-csiros-war-on-ts/ https://microkerneldude.org/2022/02/17/a-story-of-betrayal-c... 1. https://microkerneldude.org/2022/03/22/ts-in-2022-were-back/ https://microkerneldude.org/2022/03/22/ts-in-2022-were-back/
- Animats 3y agoThe trouble with L4 is that it's so low-level you have to put another OS on top of it to do anything Which usually means a bloated Linux. QNX offers a basic POSIX interface, implemented mostly as libraries.
- snvzz 3y agoNote that L4 and seL4 are very different kernels. They represent the 2nd generation and 3rd generation of microkernels respectively. With that out of the way, you're right in that the microkernel doesn't present a posix interface. But, like QNX, there are libraries for that, seL4 foundation itself maintains some. They have a major ongoing effort on system servers, driver APIs and ways to deploy system scenarios. Some of them were talked about in a recent seL4 conference. And then there's third party efforts like the amazing Genode[0], which supports dynamic scenarios with the same drivers and userspace binaries across multiple microkernels. They even have a modern webbrowser, 3d acceleration as well as providing a virtualbox box that runs inside Genode, so the dogfooding developers are be able to run e.g. Linux inside a virtualbox to bridge the gap. 0. https://www.genode.org/ https://www.genode.org/
- bregma 3y agoThe current (SDP 8) kernel has 15331 lines of code, including comments and Makefiles.
- gigatexal 3y agoQNX is used in vehicle infotainment systems no? Where else? I'm not bothered by the kernel bloat. There's a lot of dev time being invested in Linux and while the desktop is not as much of a priority as say the server space a performant kernel on handhelds and other such devices and the dev work to get it there will benefit the desktop users like myself.
- bkallus 3y agoI went to a conference at GE Research where I spoke to some QNX reps from Blackberry for a while. Seemed like they were hinting that some embedded computers in some of GE'S aerospace and energy stuff relies on QNX.
- lmm 3y ago> QNX is used in vehicle infotainment systems no? Where else? A bunch of similar embedded systems. And blackberry, if anyone's still using them.
- deleted 3y ago[deleted]
- tyfon 3y agoIt was used in my old toyota avensis from 2012. The infotainment was so slow you could measure performance in seconds pr frame instead of frames pr second :) In the end, all I could practically use it for was as a bluetooth audio connector.
- notrom 3y agoI've worked with it in industrial automation systems in large scale manufacturing plants where it was pretty rock solid. And I'm aware of it's use in TV production and transmissions systems.
- Cyph0n 3y agoCisco routers running IOS-XR, until relatively recently.
- SubjectToChange 3y ago
- deleted 3y ago[deleted]
- gigatexal 3y ago> QNX had this right decades ago. The microkernel has upper bounds on everything it does. There are only a few tens of thousands of lines of microkernel code. All the microkernel does is allocate memory, dispatch the CPU, and pass messages between processes. Everything else, including drivers and loggers, is in user space and can be preempted by higher priority threads. So much like a well structured main method in a C program or other C like language where main just orchestrates the calling of other functions and such. In this case main might initialize different things where the QNX kernel doesn't but the idea or general concept remains. I'm no kernel dev but this sounds good to me. Keeps things simple.
- vacuity 3y agoRecently, I've been thinking that we need a microkernel design in applications. You have the core and then services that can integrate amongst each other and the core that provide flexibility. Like the "browser as an OS" kind of things but applied more generally.
- galdosdi 3y agoYes! This reminds me strongly of the core/modules architecture of the apache httpd, as described by the excellent O'Reilly book on it. The process of serving an HTTP request is broken into a large number of fine grained stages and plugin modules may hook into any or all of these to modify the input and output to each stage. The same basic idea makes it easy to turn any application concept into a modules-and-core architecture. From the day I read (skimmed) that book a decade or two ago this pattern has been burned into my brain
- blackth0rn 3y agoECS systems for the gaming world are somewhat like this. There is the core ECS framework and then the systems and entity's integrate with each other
- spookie 3y agoECS is incredible. Other areas should take notice
- js2 3y agoVxWorks is what's used on Mars and it's a monolithic kernel, so there's more than one way to do it. :-)
- dilyevsky 3y agoI think RT build also had to disable mmu
- signa11 3y agothis feels like tannenbaum-torvalds debate once again.
- creshal 3y ago> Millions of lines of kernel, all of which have to be made preemptable. ~90% of those are device drivers, which you'd still need with a microkernel if you want it to run or arbitrary hardware.
- dontlaugh 3y agoBut crucially, drivers in a microkernel run in user space and are thus pre-emptible by default. Then the driver itself only has to worry about dealing with hardware timing when pre-empted.
- creshal 3y agoSure, but who's going to write the driver in the first place? Linux's "millions of lines of code" are a really underappreciated asset, there's tons of obscure hardware that is no longer supported by any other actively maintained OS.
- dontlaugh 3y agoI also don't see how we could transition to a microkernel, indeed.
- naasking 3y agoThe very first "hypervisors" were actually microkernels that ran Linux as a guest. This was done with Mach on PowerPC/Mac systems, and also the L4 microkernel. That's one way. The only downside of course, is that you don't get the isolation benefits of the microkernel for anything depending on the Linux kernel process.
- AndyMcConachie 3y agoLinus Torvalds and Andrew Tannenbaum called. They want their argument back!