I read once that one advantage of a microkernel architecture is that you can stop/start essential services like networking and filesystems, without needing to restart the whole system. But considering that Linux kernel nowadays (was it always the case?) offers the option to use modules to achieve the same effect, what are the (remaining) advantages of a microkernel?
|
|
Microkernels require less code to be run in the innermost, most trusted mode than monolithic kernels. This has many aspects, such as:
Unix GUIs are provided via X window, which is userland code (except for (part of) the video device driver). Many modern unices allow ordinary users to load filesystem drivers through FUSE. Some of the Linux network packet filtering can be done in userland. However, device drivers, schedulers, memory managers, and most networking protocols are still kernel-only. A classic (if dated) read about Linux and microkernels is the Tanenbaum–Torvalds debate. Twenty years later, one could say that Linux is very very slowly moving towards a microkernel structure (loadable modules appeared early on, FUSE is more recent), but there is still a long way to go. Another thing that has changed is the increased relevance of virtualization on desktop and high-end embedded computers: for some purposes, the relevant distinction is not between the kernel and userland but between the hypervisor and the guest OSes. |
|||
|
|
|
A microkernel limits the time the system is in kernel mode, as opposed to userspace, to the absolute minimum possible. If a crash happens in kernel mode, the entire kernel goes down, and that means the entire system goes down. If a crash happens in user mode, just that process goes down. Linux is robust in this regard, but it's still possible for any kernel subsystem to write over the memory of any other kernel subsystem, either purposefully or accidentally. The microkernel concept puts a lot of stuff that is traditionally kernel mode, such as networking and device drivers, in userspace. Since the microkernel isn't really responsible for a lot, that also means it can be simpler and more reliable. Think of the way the IP protocol, by being simple and stupid, really leads to robust networks by pushing complexity to the edges and leaving the core lean and mean. |
|||
|
|
|
You should read the other side of the issue: |
|||
|
|
|
The case is that linux kernel is a hybrid of monolithic and microkernel. In a pure monolithic implementation there are no modules loading at runtime. |
|||||||||
|
|
Just take a look at x86 architecture -- monolithic kernel only uses rings 0 and 3. A waste, really. But than again it can be faster, because of less context switching.
|
|||
|
|
|
||||
|
|
