Microkernel: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
m (Fixing categories)
(The memory manager *may* be implemented in userspace - doesn't have to be.)
 
(14 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{Template:Kernel designs}}
==Design==
== Design ==
[[Image:Microkernel.png|frame|right|Basic overview of a microkernel]]
[[Image:Microkernel.png|frame|right|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).
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 physical memory allocation (the actual memory '''manager''' may be implemented in userspace), 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 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' that support multi-CPU computers (much simpler re-entrancy protection and better suitability for asynchronious functionality) and distributed OS' (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 monolithic kernels. (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 a data recovery system exists. Microkernels can be more stable, but it requires additional design work; it 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).
Line 13: Line 14:
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.
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.


==Related Links==
== Examples ==
* Mach
*[http://directory.google.com/Top/Computers/Software/Operating_Systems/Microkernel/ 'microkernel' google directory]
* QNX
*[http://www.cbbrowne.com/info/microkernel.html Christopher Browne: microkernel effort]
* [[L4]]
* AmigaOS
* [http://minix3.org Minix]


== See Also ==
===Recommended Reading===

*[http://www.google.com/search?q=The+Increasing+Irrelevance+of+IPC+Performance+for+Microkernel-Based+Operating+Systems The Increasing Irrelevance of IPC performance in Microkernel-based Operating Systems] by Brian N. Bershad
=== Forum Threads ===
*[http://www.google.com/search?q=The+Persistent+Relevance+of+IPC+Performance+for+Microkernel-Based+Operating+Systems The Persistent Relevance of IPC performance in Microkernel-based Operating Systems] by Wilson C. Hsieh, M. Frans Kaashoek, and William E. Weihl
* [[Topic:10099|microkernels]]
*[http://citeseer.ist.psu.edu/408369.html µ-Kernels Must And Can Be Small] by Jochen Liedtke
* [[Topic:10234|discussing microkernel vs modular macrokernel]]

==== Recommended Reading ====
* [http://www.google.com/search?q=The+Increasing+Irrelevance+of+IPC+Performance+for+Microkernel-Based+Operating+Systems The Increasing Irrelevance of IPC performance in Microkernel-based Operating Systems] by Brian N. Bershad
* [http://www.google.com/search?q=The+Persistent+Relevance+of+IPC+Performance+for+Microkernel-Based+Operating+Systems The Persistent Relevance of IPC performance in Microkernel-based Operating Systems] by Wilson C. Hsieh, M. Frans Kaashoek, and William E. Weihl
* [http://citeseer.ist.psu.edu/408369.html µ-Kernels Must And Can Be Small] by Jochen Liedtke
* [http://linuxfinances.info/info/microkernel.html Microkernel-based OS Efforts] by Christopher Browne
* [http://web.archive.org/web/20140803112320/http://i30www.ira.uka.de/~neider/edu/mkc/mkc.html Microkernel Construction Notes] by Raphael Neider


[[Category:Kernel]]
[[Category:Kernel]]

Latest revision as of 14:33, 15 June 2021

Kernel Designs
Models
Other Concepts

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 physical memory allocation (the actual memory manager may be implemented in userspace), 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' that support multi-CPU computers (much simpler re-entrancy protection and better suitability for asynchronious functionality) and distributed OS' (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 monolithic kernels. (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 a data recovery system exists. Microkernels can be more stable, but it requires additional design work; it 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

See Also

Forum Threads

Recommended Reading