Ask HN: Examples of Microkernels?
I'm reading through the MIT xv6 OS handbook and code (here: https://github.com/mit-pdos/xv6-riscv/) and they mention the fact that they created it as a monolithic kernel since most unix systems are monolithic. They then introduce the microkernel concept. Are there microkernel concepts out there (especially code) I can check out? I'm curious to see how userspace processes communicate to kernel processes to execute privileged actions.
79 comments
[ 0.29 ms ] story [ 159 ms ] threadhttps://git.minix3.org/index.cgi?p=minix.git
Happy to be wrong though, I'd like new code to look at.
That says something about what one bunch of Very Careful Engineers think about the implementation's uptime and reliability provenance...
(The ME-cleaner project has identified that if Intel ME does not initialize, the CPU resets a few minutes after power on - so this suggests that a hard-unrecoverable error would leave the CPU unusable.)
https://en.m.wikipedia.org/wiki/Tanenbaum%E2%80%93Torvalds_d...
I had a student edition of that book, back in the late 1980s. It had a full listing of the Minix source code as an appendix: fascinating to be able to sit in a comfortable chair and read a large body of code. I referred to it a lot when i was learning C. I'm guessing Minix has got bigger since then though.
I haven't worked with seL4, but used an earlier branch of the L4 family (L4Ka::Pistachio) as a base for a toy OS (university project).
If I had the time to tinker with base OS design today, I'd definitely start with seL4.
Edited to add: the whitepaper here is a good intro to seL4: https://sel4.systems/About/seL4-whitepaper.pdf
oooooh.
It's almost a lame/inane question when framed this broadly, but: where can I read more about similarly incredibly obscure yet Really Important™ applications of technology that have just about completely disappeared into the woodwork?
For example, a quick google search of "how many microcontrollers in a car?" gives 50 as a common answer. For every system that people think about as a computer (entertainment, engine controller, airbags) there are another 10 systems that are also tiny computers that we kind of expect to mostly work together just about perfectly, forever.
Feels pretty obscure and somewhat important, but maybe not incredibly obscure and really important. :/
https://sel4.systems/About/seL4-whitepaper.pdf
https://cs.opensource.google/fuchsia
https://github.com/littlekernel/lk
So, you're supposed to spell this guy's name with a capital F.
> Leonhart Fuchs (German: [ˈleːɔnhaʁt ˈfʊks] ... sometimes spelled Leonhard Fuchs and cited in Latin as Leonhartus Fuchsius
TIL... that flower fews like Fuschius?
https://support.apple.com/guide/security/kernel-extensions-s...
Mach is a pre-Liedtke microkernel. It's slow at IPC. Which is bad when IPC is what it has to do the most in a proper multi-server system.
This the the best thing in commercial software, decisions happen, and there are no forks botching the final outcome by disgruntled devs.
I'm not a software engineer, but out of curiosity.
I wonder if the computer industry in general tend to overlook at performance, that's how I feel about the hardware community, where a tiny differences in benchmarks always taking the crown.
It is available, and it's called darwin-xnu:
https://github.com/apple/darwin-xnu
a mix of Mach and a FreeBSD kernel:
https://i0.wp.com/www.linuxandubuntu.com/wp-content/uploads/...
And a really good yt presentation:
24C3: Inside the Mac OS X Kernel
https://www.youtube.com/watch?v=-7GMHB3Plc8
> https://www.youtube.com/watch?v=-7GMHB3Plc8
https://fahrplan.events.ccc.de/congress/2007/Fahrplan/events...
https://opensource.apple.com/releases/
Click on the release (Monterey 12.5) and scroll down. xnu-8020.140.41 is there..
Links to: https://github.com/apple-oss-distributions/xnu/tree/xnu-8020...
FreeRTOS [3] bundles in a microkernel [4].
Speaking of FreeRTOS, you may also be interested in Riot OS developer's blog entry on building a (micro?) kernel [5].
[0] https://github.com/rcore-os/rCore
[1] https://github.com/rcore-os/zCore
[2] https://archive.is/Y49Ih
[3] https://github.com/FreeRTOS/FreeRTOS-Kernel
[4] https://archive.is/u8Hsw
[5] https://archive.is/0MHF1
nova
okl4_x86
foc
fiasco
pistachio
linux
sel4
https://genode.org/documentation/components
Also QNX and RTEMS need's to be mentioned here.
And Helios/Ares-os:
https://sr.ht/~sircmpwn/helios/
i.e. everything that was wrong with them, before Liedtke proposed L3 and L4.
> ... construct unikernels for secure, high-performance network applications across a variety of cloud computing and mobile platforms. Code can be developed on a normal OS such as Linux or macOS, and then compiled into a fully-standalone, specialised unikernel that runs under a Xen or KVM hypervisor.[1]
[0] : https://github.com/mirage/qubes-mirage-firewall
[1] : https://mirageos.org/
About page: https://composite.seas.gwu.edu/
GitHub: https://github.com/gwsystems/composite
A system that claims to allow you to configure it in microkernel and other modes might be interesting for comparison of the approaches, but I've only noticed it via a local connexion: https://project-flexos.github.io/
[1] https://www.qnx.com/developers/docs/6.3.0SP3/neutrino/
I think it was even MIT or BSD or similar?
They also had pretty liberal hobbyist/non-commercial license which let you learn the toolchain and develop with some of the middleware. That all went away when RIM (blackberry now) bought them.
Re: manuals - QNX Cookbook was also pretty good read. The documentation from that era were published as real books.
But I think one of the main mechanisms is basically non-kernel services install their own system calls (SVCs) and this SVC will schedule a light-weight thread (SRB) in the requestor's address space.
There was an older book that described how to create a simple OS along similar lines to MVS, but I don't remember the name.
[1] https://betrusted.io/xous-book/ch00-00-introduction.html
[2] https://github.com/betrusted-io/xous-core
https://en.wikipedia.org/wiki/Hybrid_kernel#:~:text=Windows%....
https://hubris.oxide.computer/reference/
It's all open-source on Github:
https://github.com/oxidecomputer/hubris
(I work at Oxide, mostly using Hubris)
And someone else already did mention it.
I've only glanced at it, but there's some teaching material from L4 land apparently in the usual excellent German technical English at https://tu-dresden.de/ing/informatik/sya/professur-fuer-betr...
https://en.wikipedia.org/wiki/Taligent
https://en.wikipedia.org/wiki/Copland_(operating_system)
https://en.wikipedia.org/wiki/Workplace_OS
QNX was
It might be that it was mostly used in embedded stuff, but that's true of Linux too, not an inherent limit.
https://www.theregister.com/1998/11/14/amiga_2_to_use_qnx/
But it didn't work out:
https://www.trollaxor.com/2005/06/how-qnx-failed-amiga.html
The source code is included by default so you can boot and jump right in. Code is very clean, minimal and approachable.
The reason why it is not a microkernel is because hardware drivers and some performance sensitive code such as ip, tls and graphics are in kernel. The rest, including on-disk file system (cwfs, fat, ext, etc), certain usb drivers, etc run in user space.
> I'm curious to see how userspace processes communicate to kernel processes to execute privileged actions.
You write and read messages to synthetic files served by the kernel. Kernel files are served via a special # prefix so they can be opened by any program locally. Since user space programs can speak 9p you don't need any special programs to make syscalls to talk to the kernel. e.g. to list disks served by the sd(3) driver run 'ls '#'S'
Everything is just messages. Even unix signals were replaced with notes. To send a note to a process all you do is 'echo hello >/proc/$pid/ctl' and in the program you register one or more note handlers that simply do a strcmp() and if the note matches a string you define then do something. (if you complain about /proc and never used plan 9 /proc then your argument is invalid.)
If you think about it, plan 9 is just a host for microservices.
I recommend using 9front to explore.
OSF/1, the attempt at an industry standard next-gen Unix by what is now the Open Group, holders of the UNIX trademark, also ran on Mach. Only DEC shipped it, though. The filesystem is now FOSS but I don't think the rest of DEC's code was, sadly. https://en.wikipedia.org/wiki/OSF/1
Chorus is out there: https://en.wikipedia.org/wiki/ChorusOS
HelenOS, from the Charles University here in Prague where I write, is a FOSS microkernel OS. http://www.helenos.org/