Microkernel: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
No edit summary
Line 5: Line 5:
In theory, this concept makes the kernel more responsive (since much functionality resides in preemptible user-space threads and processes, removing the need for context-switching into the kernel proper), and improves the stability of the kernel by reducing the amount of code running in kernel space. There are also additional benefits for OS's that support multi-CPU computers (much simpler re-entrancy protection and better suitability for asynchronious functionality) and distributed OS's (code can use services without knowing if the service provider is running on the same computer or not). A drawback is the amount of messaging and Context Switching involved, which makes microkernels conceptually slower than a Monolithic Kernel. (This isn't to say that a smartly designed microkernel could not beat a foolishly designed monolithic one.)
In theory, this concept makes the kernel more responsive (since much functionality resides in preemptible user-space threads and processes, removing the need for context-switching into the kernel proper), and improves the stability of the kernel by reducing the amount of code running in kernel space. There are also additional benefits for OS's that support multi-CPU computers (much simpler re-entrancy protection and better suitability for asynchronious functionality) and distributed OS's (code can use services without knowing if the service provider is running on the same computer or not). A drawback is the amount of messaging and Context Switching involved, which makes microkernels conceptually slower than a Monolithic Kernel. (This isn't to say that a smartly designed microkernel could not beat a foolishly designed monolithic one.)


The "in theory" starting above paragraph means that, yes, your kernel would not crash alongside with e.g. a crashing filesystem. But your user would still be stuck with data he cannot save, unless you made provisions to restart the filesystem server / daemon. Microkernels can be more stable, but it requires additional design work and does not come free with the architecture. Likewise, the additional design work that has to be done to get a microkernel design right could also be spent on making a monolithic kernel preemptable.
In practice things can be quite different. For example, if the filesystem crashed the kernel would continue running, but the user would still lose some data - unless provisions were made to restart the filesystem server / daemon, and data a data recovery system exists. Microkernels can be more stable, but it requires additional design work and does not come free with the architecture. Likewise, the additional design work that has to be done to get a microkernel design right could also be spent on making a monolithic kernel preemptable.


AmigaOS, for example, was a microkernel - and an unusual one: Since the original AmigaOS had no memory protection, its messaging was as quick as it could get (passing a pointer to memory), making the AmigaOS kernel one of the fastest ever devised. On the other hand, that lack of memory protection also meant that the microkernel architecture gave no added stability (later versions did implement MMU support, but at the same speed cost that affects other microkernel systems).
AmigaOS, for example, was a microkernel - and an unusual one: Since the original AmigaOS had no memory protection, its messaging was as quick as it could get (passing a pointer to memory), making the AmigaOS kernel one of the fastest ever devised. On the other hand, that lack of memory protection also meant that the microkernel architecture gave no added stability (later versions did implement MMU support, but at the same speed cost that affects other microkernel systems).

Revision as of 21:55, 13 January 2007

Design

Basic overview of a microkernel

A Microkernel tries to run most services - like networking, filesystem, etc. - as daemons / servers in user space. All that's left to do for the kernel are basic services, like memory allocation, scheduling, and messaging (Inter Process Communication).

In theory, this concept makes the kernel more responsive (since much functionality resides in preemptible user-space threads and processes, removing the need for context-switching into the kernel proper), and improves the stability of the kernel by reducing the amount of code running in kernel space. There are also additional benefits for OS's that support multi-CPU computers (much simpler re-entrancy protection and better suitability for asynchronious functionality) and distributed OS's (code can use services without knowing if the service provider is running on the same computer or not). A drawback is the amount of messaging and Context Switching involved, which makes microkernels conceptually slower than a Monolithic Kernel. (This isn't to say that a smartly designed microkernel could not beat a foolishly designed monolithic one.)

In practice things can be quite different. For example, if the filesystem crashed the kernel would continue running, but the user would still lose some data - unless provisions were made to restart the filesystem server / daemon, and data a data recovery system exists. Microkernels can be more stable, but it requires additional design work and does not come free with the architecture. Likewise, the additional design work that has to be done to get a microkernel design right could also be spent on making a monolithic kernel preemptable.

AmigaOS, for example, was a microkernel - and an unusual one: Since the original AmigaOS had no memory protection, its messaging was as quick as it could get (passing a pointer to memory), making the AmigaOS kernel one of the fastest ever devised. On the other hand, that lack of memory protection also meant that the microkernel architecture gave no added stability (later versions did implement MMU support, but at the same speed cost that affects other microkernel systems).

One of the side-effects of using a micro-kernel design (or a modular Monolithic Kernel), is the changes needed for booting the OS. If the file system is handled by a user-space process loaded by the kernel, the kernel itself contains no code to handle file systems or storage device drivers to load the file system process in the first place. One method of resolving this is for the boot loader to load a "RAM disk image", containing the kernel and several support files (device drivers, etc).

It's also possible for an OS design to borrow concepts from both monolithic kernels and micro-kernels in order to use the benefits of either method where appropriate.

Examples

  • Mach
  • QNX
  • L4
  • AmigaOS
  • Minix

See Also

Forum

External Links

Recommended Reading