2 ms·
Plan 9 is a great example of a hybrid kernel that is very much in the spirit of a microkernel. It uses 9p as the foundation meaning the whole OS is based around
by MisterTea 4y ago
Plan 9 is a great example of a hybrid kernel that is very much in the spirit of a microkernel. It uses 9p as the foundation meaning the whole OS is based around a file-like message oriented RPC protocol. Every process has its own namespace and mount table so you implement security by limiting mounted resources to a child proc and its children. Since the 9p byte streams are processor agnostic you don't have endian or cross platform problems so you don't care about a remote machines architecture.
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.