15
$\begingroup$

A microkernel implements all drivers as user-space programs, and implements core features like IPC in the kernel itself. A monolithic kernel, however, implements the drivers as a part of the kernel (e.g. runs in kernel mode).

I have read some claims that microkernels are slower than monolithic kernels, since they need to handle message passing between the drivers in user space. Is this true?

For a long time, most kernels were monolithic because the hardware was too slow to run micro-kernels quickly. However, there are now many microkernels and hybrid kernels, like GNU/Hurd, Mac OS X, Windows NT line, etc.

So, has anything changed about the performance of microkernels? Is this criticism of microkernels still valid today?

$\endgroup$

2 Answers 2

11
$\begingroup$

As is always the answer (or at least the preface) to performance-related questions: know your problem domain, run comparative benchmarks, and remember what premature optimization is.

First, no comprehensive benchmarking trials have compared monolithic kernels to current-generation microkernel systems that operate in an equivalent manner. So, while there may be trials that compare specific elements of those kernels, they're not going to be representative of the "big picture" that your question is looking to paint.

With that being said, there are wildly divergent observations of kernel performance across microkernels; for example, the L4 microkernel family can be said to have IPC performance an order of magnitude higher than the Mach kernel. But every Apple device from this decade is running Mach, and they seem to work plenty fast, right?

The moral of the story is that anybody who's deciding what kernel architecture to use needs to first decide what their ultimate goal is. Microkernel systems are (when properly implemented, of course) more secure, maintainable, and modular. However, they can be tough to architect properly, and may have performance overhead over a monolithic implementation. A monolithic kernel will be faster, but security will be harder to implement and it will be less modular and less easy to customize.

Your kernel architecture should be based on what your end goal is.

(And when all else fails, try it both ways and see what happens.)

$\endgroup$
1
  • 1
    $\begingroup$ "But every Apple device from this decade is running Mach, and they seem to work plenty fast, right?" That is only partially correct. "The kernel of Darwin is XNU, a hybrid kernel which uses OSFMK 7.3 (Open Software Foundation Mach Kernel) from the OSF, various elements of BSD (including the process model, network stack, and virtual file system), and an object-oriented device driver API called I/O Kit. The hybrid kernel design provides the flexibility of a microkernel and the performance of a monolithic kernel." $\endgroup$ May 14, 2019 at 4:59
5
$\begingroup$

I prefer to call Windows NT and Apple's XNU kernel monolithic instead of hybrid. I don't find the classification of hybrid to have much meaning in practice. In fact one of the original engineers of XNU calls it monolithic[1].

On the issue of performance, the only really in-depth comparison of monolithic vs micro I can find is "Extreme High Performance Computing or Why Microkerenels Suck"[2] and a rebuttal presentation "Do Microkernels Suck?"[3].

Modularity and customizablity are more issues of design than inherent limitations in monolithic kernels. The Linux kernel, for example, can range from several megabytes to around one megabyte in size dependent on compile-time options and the application of certain patches. The vast majority of Linux's 15 million plus lines of code are loadable kernel modules. They are compiled separately from the base kernel and only loaded when needed. Those modules can implement drivers and system calls (even overriding base system calls).

The two areas where microkernels have an undisputed advantage is in low memory (<=512k ram) or "hard" Real-time operating systems, like airline flight systems or nuclear reactor control systems.

Edit: Talking further on the advantages and disadvantages of either kernel architecture, Gernot Heiser freely admits at the end of his presentation[3] that monolithic kernels are inherently more performant because a microkernel always has some extra overhead. Though, that extra overhead does lead to increased reliability, hence microkernels dominance of RTOS.

[1] Louis G. Gerbarg, "Advanced Synchronization in Mac OS X: Extending Unix to SMP and Real-Time", Proceedings of BSDCon 2002 Conference, pp. 2

[2] Chistoph Lameter, "Extreme High Performance Computing or Why Microkernels Suck", 2007 Linux Symposium, Volume One

[3] Gernot Heiser, "Do Microkernels Suck?", 9th Linux.conf.au, January, 2008

$\endgroup$
3
  • $\begingroup$ I was classifying XNU and Windows NT as "hybrid" kernels $\endgroup$
    – mmk
    Nov 25, 2015 at 21:55
  • $\begingroup$ Thanks @D.W. for the welcome. I've cleaned up my post a bit, and added cites. $\endgroup$
    – Ironlenny
    Nov 30, 2015 at 19:09
  • $\begingroup$ @mmk Sorry, you did call them hybrids, I was just in a hurry to make my post and misread. $\endgroup$
    – Ironlenny
    Nov 30, 2015 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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