Hi,
B.E wrote:In theroy a micro kernel is the best type of kernel, because it has the best program protection (there are other reasons, just can't think of them at the moment). But in practice because every thing in the system has to communicate though message passing (progam A want to talk to program B), and things like putting the PIT in user mode make a micro kernel design is inherently slow.
IMHO there's a compromise - simplicity & speed vs. protection & modularity.
Shifting anything to user-space can reduce the speed of the OS (because you end up with more context switches and IPC overhead) while improving protection and modularity (as anything in user-space is isloated from everything else and could theoretically be stopped, replaced, restarted, etc).
In the most extreme case, the "kernel" could include interrupt handling stubs, a low level "switch to task X" routine, some IPC code and some routines to manipulate page directories and page tables, with everything else in user-space (most of the scheduler, the physical memory manager, most of the linear memory manager, etc).
Some things should never be in the kernel because the advantages of putting them in user-space are far greater than any disadvantages. Examples include applications, "daemons", GUIs, CLIs, etc. For some things the advantages are more than the disadvantages (keyboard & mouse, floppy, sound, printer).
Some things are "borderline", where the advantages and disadvantages might cancel each other out (depending on the goals of the OS). This includes hard disk controllers (IDE & SCSI), video, USB controllers and some network cards.
Then there's things where the disadvantages are probably more than the advantages. In this category I'd include high speed network cards, the scheduler (and it's timer/s), the linear memory manager, the physical memory manager, etc.
So the question is, for each "thing", what are the advantages and disadvantages of shifting it to user-space, and is it worth it?
In the past the answer was often "no", because there were fewer devices and CPUs were slower (for e.g. an average of 5000000 cycles of overhead each second works out to 5% of CPU time on a 100 MHz CPU and 0.25% of CPU time on a 2 GHz CPU). For the number of devices, back when 80386 was "new" there was much fewer devices to worry about - it wouldn't have been hard to make sure all device drivers were reliable. Now there's thousands of devices and it'd be impossible to guarantee that each device driver always does what it should. As things progress, the advantages of shifting things to user-space become more important than the disadvantages...
Given that Vista has taken Microsoft over 5 years to make, it would be optimistic to say any of us will be able to produce a useful OS in less than 10 years. In 10 years time, for each "thing", what will be the advantages and disadvantages of shifting it to user-space, and will it be worth it?
B.E wrote:This the reason linux and windows use a different design.
Linux "borrows" concepts from micro-kernels. For Microsoft, in Vista most USB devices and half the sound & video is shifted to user space. I saw a video about their "User-mode Device Framework" - the guy responsible for designing this framework mentioned a "dancing Homer Simpson" that plugs into a USB port, and how insane it is that people need to mess around in kernel-mode to make Homer dance...
Cheers,
Brendan