This particular issue could be solved in most cases in a monolithic kernel. That it isnβt, is by design. But itβs a terrible design decision, because it can lead to situations where (for example) a zombie process locks a mount point and prevents unmounting because the kernel insists itβs still in use by the zombie process. Which the kernel provides no mechanism for terminating.
It is provable via experiment in Linux by use of fuse filesystems. Create a program that is guaranteed to become a zombie. Run it within a filesystem mounted by an in-kernel module, like a remote nfs mount. You now have a permanently mounted NFS mount point. Now, use mount something using fuse, say a WebDAV remote point. Run the same zombie process there. Again, the mount point is unmountable. Now, kill the fuse process itself. The mount point will be unmounted and disappear.
This is exactly how microkernels work. Every module is killable, crashable, upgradable - all without forcing a reboot or affecting any processes not using the module. And in a well-designed microkernel, even processes using the module can in many cases continue functioning as if the restarted kernel module never changed.
Fuse is really close to the capabilities of microkernels, except itβs only filesystems. In a microkernel, nearly everything is like fuse. A linux kernel compiled such that everything is a loadable module, and not hard linked into the kernel, is close to a microkernel, except without the benefits of actually being a microkernel.
Microkernels are better. Popularity does not prove superiority, except in the metric of popularity.
This particular issue could be solved in most cases in a monolithic kernel. That it isnβt, is by design.
It was(see CLONE_DETATCHED here) and is(source)
Create a program that is guaranteed to become a zombie. Run it within a filesystem mounted by an in-kernel module, like a remote nfs mount. You now have a permanently mounted NFS mount point.
Ok, this is not really good implementation. Iβm not sure that standard requires zombie processes to keep mountpoints(unless its executable is located in that fs) untill return value is read. Unless there is call to get CWD of another process. Oh, wait. Canβt ptrace issue syscall on behalf of zombie process or like that? Or use vfs of that process? If so, then it makes sense to keep mountpoint.
Every module is killable, crashable, upgradable - all without forcing a reboot or affecting any processes not using the module.
except without the benefits of actually being a microkernel.
Except Linux does it too. If graphics module crashes, I still can SSH into system. And when I developed driver for RK3328 TRNG, it crashed a lot. Replaced it without reboot.
Microkernels are better. Popularity does not prove superiority, except in the metric of popularity.
As I said, we live in post-meltdown world. Microkernels are MUCH slower.
As I said, we live in post-meltdown world. Microkernels are MUCH slower.
Iβve heard this from several people, but youβre the lucky number by which Iβd heard it enough that I bothered to gather some references to refute this.
First, this is an argument that derived from first generation microkernels, and in particular, MINIX, which - as a teaching aid OS, never tried to play the benchmark game. Itβs been repeated, like dogma, through several iterations of microkernels which have, in the interim, largely erased most of those performance leads of monolithic kernels. One paper notes that, once the working code exceeds the L2 cache size, there is marginal advantage to the monolithic structure. A second paper running benchmarks on L4Linux vs Linux concluded that the microkernel penalty was only about 5%-10% slower for applications than the Linux monolithic kernel.
This is not MUCH slower, and - indeed - unless youβre doing HPC applications, is close enough to be unnoticeable.
Edit: I was originally going to omit this, as itβs propaganda from a vested interest, and includes no concrete numbers, but this blog entry from a product manager at QNX specifically mentions using microkernels in HPC problem spaces, which I thought was interesting, so Iβm post-facto including it.
First, this is an argument that derived from first generation microkernels, and in particular, MINIX, which - as a teaching aid OS, never tried to play the benchmark game.
Indeed, first generation microkernels were so bad, that Jochen Liedtke in rage created L3 βto show how itβs doneβ. While it was faster than existing microkernels, it was still slow.
One paper notes that, once the working code exceeds the L2 cache size, there is marginal advantage to the monolithic structure.
- The paper was written in pre-meltdown era.
- The paper is about hybrid kernels. And gutted Mach(XNU) is used as example.
- Nowdays(after meltdown) all cache levels are usually invalidated during context switch. Processors try to add mechanisms to avoid this, but they create new vulnreabilities.
A second paper running benchmarks on L4Linux vs Linux concluded that the microkernel penalty was only about 5%-10% slower for applications than the Linux monolithic kernel.
-
- Waaaaay before meltdown era.
Iβll mark quotes from paper as doublequotes.
a Linux version that executes on top of a first- generation Mach-derived Β΅-kernel.
- So, hybrid kernel. Not as bad as microkernel.
The corresponding penalty is 5 times higher for a co-located in-kernel version of MkLinux, and 7 times higher for a user- level version of MkLinux.
Wait, what? Co-located in-kernel? So, loadable module?
In particular, we show (1) how performance can be improved by implementing some Unix services and variants of them directly above the L4 Β΅-kernel
- No surprise here. Hybrids are faster than microkernels. Kinda proves my point, that moving close to monolithic improves performance.
Right now I stopped at the end of second page of this paper. Maybe will continue later.
Will read.