Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
3  
On the topic of microkernels and Linux, see also this very good answer to “Why linux is called monolithic kernel”. –  Gilles Feb 26 '11 at 12:08

6 Answers 6

up vote 16 down vote accepted

Microkernels require less code to be run in the innermost, most trusted mode than monolithic kernels. This has many aspects, such as:

  • Microkernels allow non-fundamental features (such as drivers for hardware that is not connected or not in use) to be loaded and unloaded at will. This is mostly achievable on Linux, through modules.
  • Microkernels are more robust: if a non-kernel component crashes, it won't take the whole system with it. A buggy filesystem or device driver can crash a Linux system. Linux doesn't have any way to mitigate these problems other than coding practices and testing.
  • Microkernels have a smaller trusted computing base. So even a malicious device driver or filesystem cannot take control of the whole system (for example a driver of dubious origin for your latest USB gadget wouldn't be able to read your hard disk).
  • A consequence of the previous point is that ordinary users can load their own components that would be kernel components in a monolithic kernel.

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
7  
it's not. the fact that modules are loaded dynamically does not change the fact, that they are run with full kernel privileges, and as part of monolithic kernel. –  vartec Jan 26 '11 at 14:05
1  
For hybrid design it would be more important wheather some drivers (for USB, Scanners, Printers and graphics) are implemented in userspace rather then kernel. The distinction is not clear and Linux can be stated as hybrid kernel as there is libusb, sane, cups and mesa - not because there is insmod and rmmod. –  Maciej Piechotka Jan 26 '11 at 16:02

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.

x86 rings

share|improve this answer
  1. Monolithic kernel is much older than Microkernel. It’s used in Unix . while Idea of microkernel appeared at the end of the 1980's.

  2. the example of os having the Monolithic kernels are UNIX , LINUX while the os having Microkernel are QNX , L4 , HURD , initially Mach (not mac os x) later it will converted into hybrid kernel , even MINIX is not pure kernel because device driver are compiled as part of the kernel .

  3. Monolithic kernel are faster than microkernel . while The first microkernel Mach is 50% slower than Monolithic kernel while later version like L4 only 2% or 4% slower than the Monolithic kernel .

  4. Monolithic kernel generally are bulky . while Pure monolithic kernel has to be small in size even fit in s into processor first level cache (first generation microkernel).

  5. in the Monolithic kernel device driver reside in the kernel space . while In the Microkernel device driver reside in the user space.

  6. since the device driver reside in the kernel space it make monolithic kernel less secure than microkernel . (Failure in the driver may lead to crash) while Microkernels are more secure than the monolithic kernel hence used in some military devices.

  7. Monolithic kernels use signals and sockets to ensure IPC while microkernel approach uses message queues . 1 gen of microkernel poorly implemented IPC so were slow on context switches.

  8. adding new feature to a monolithic system means recompiling the whole kernel while You can add new feature or patches without recompiling.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.