Page 1 of 1
Kernel (micro/monolithic) Advantages/Disadvantages
Posted: Sun Jun 19, 2005 7:23 pm
by vile
Hello,
I'd like to know the following questions so I can decide what type of kernel to write:
What are the advantages to a microkernel? What are the disadvantages?
What are the advantages to a monolithic kernel? What are its disadvantages?

Re:Kernel (micro/monolithic) Advantages/Disadvantages
Posted: Sun Jun 19, 2005 8:54 pm
by Curufir
Well those are pretty much questions for a thesis.
The basics.
A microkernel runs most services in user-space, meaning that a buggy driver/service can't take down the kernel (Although it can render it useless. e.g. non-functioning file service). The downside is increased context switching.
A monolithic kernel is the opposite. All services run in kernel-space, meaning a buggy driver can bring the kernel to its knees. The upside is there is no context switching penality.
Beyond that there are many diverse arguments for and against both (Best for clustering etc,etc,etc). Most of these arguments are themselves based on heresay, rumour, and half-remembered Usenet flame sessions. Picking the real advantages/disadvantages (i.e. That are verified with solid data) from the imagined ('xxx said it, so it must be true') is an artform all to itself.
By service here I mean things like drivers, VM, VFS, etc, not userland applications.
Re:Kernel (micro/monolithic) Advantages/Disadvantages
Posted: Sun Jun 19, 2005 10:22 pm
by AR
To add more to what Curufir said, Microkernel's tend to have stronger security as well as stability - You can enforce capabilities on services so for example, if your TCP/IP stack gets hacked the hacker won't be able to do anything except send messages to other services and download more stuff into the TCP/IP service address space (since it doesn't have the capability for accessing files, the filesystem server will reject attempts to access files) this pretty much stalemates hackers as they can focus an attack on any one particular service yet even if they gain control of it, it is most likely useless in itself without also taking control of at least the filesystem service. The kernel can also detect that the service has stopped fulfilling it's duties and restart it.
This isn't possible with a monolithic/modular kernel as any one service in the kernel can rewrite the IDT and GDT and sieze control of everything.
Re:Kernel (micro/monolithic) Advantages/Disadvantages
Posted: Mon Jun 20, 2005 2:12 am
by Pype.Clicker
i'd daresay that there are no 'intrinsic' advantage of one over the other. The fact you make it mono/micro isn't enough to offer security or performance unless the whole rest is helping.
E.g. if you have a microkernel with a 'message pool' that is readable for all process (yes, i've heard of 'serious' systems like that) and you blindly send root password keystrokes through unencrypted messages ...
And monolithic kernel could become slow as hell if you don't design your system calls carefully or if you don't make it preemptable with sufficient granularity (remember attemps to play MP3s under an X environment with linux 2.0 ?)
All in all, I'd say it's more or less a matter of personnal preferences and "religion" than some sort of technical truth.
Re:Kernel (micro/monolithic) Advantages/Disadvantages
Posted: Mon Jun 20, 2005 3:21 am
by Brendan
Hi,
I'd just like to add that you may be better off not deciding one way or the other, but instead decide to use features of both where appropriate.
IMHO one of the most important features is an ability to dynamically load/unload/replace system code (device drivers, file systems, etc). This makes it easier to support "hot-plug" devices (e.g. USB) and ensures that interfaces between components are well defined (and hopefully well documented). Also different parts can have different licences, which might make it easier to get reference material if the kernel itself is open source (e.g. video card information under an NDA).
Cheers,
Brendan
Re:Kernel (micro/monolithic) Advantages/Disadvantages
Posted: Mon Jun 20, 2005 5:32 am
by mystran
Although object-capability systems tend to be microkernels, such a system could be implemented on top of a monolith just as well. Anyway, object-capability systems have a few interesting properties which make them a good match with microkernels.
Actually, one could think of Unix sockets as a capability system, if we assumed that there was no global namespace. That is, if there was no filesystem, just sockets, then Unix sockets would act like capabilities:
- anyone can create new sockets. Since there are no namespace anymore, you cannot connect sockets to anything, but you can always create a pre-connected socket pair.
- sockets can transfer filedescriptors, if both parties agree to do it, so we can transfer capabilities from one process to another.
- you cannot send anything to a socket, unless you have a filedescriptor to it. If the socket has no address in any namespace, then getting such filedescriptor is impossible, unless someone agrees to send you one.
That's about all you need for an object-capability system.