Designing a kernel to be preemptible
Posted: Mon Jul 05, 2004 1:06 am
Hi... I'm a first time poster, so if this topic has been discussed already, please put away the big stick.
I'm designing my own microkernel, and lately I've been thinking about the issue of kernel pre-emption, in the context of what I know about other OS' kernel architectures (NT, QNX/Neutrino, and Minix are the ones I'm most familiar with... Linux not so much).
The OS FAQ has this to say about microkernels with regard to preemption:
However, the latest version of Neutrino (which still qualifies as a microkernel AFAICS) is pre-emptible. So... what gives? It makes sense, given that it's a real-time OS and has to make pretty strict latency guarantees. But I thought pre-emption would be sort of redundant for a microkernel.
Opinions...? Is it worth the added complexity?
It seems to me that this is an important design decision to make early, since it affects the way control flow in the kernel is structured.
Finally, a bit of background on my design goals:
I'm designing my own microkernel, and lately I've been thinking about the issue of kernel pre-emption, in the context of what I know about other OS' kernel architectures (NT, QNX/Neutrino, and Minix are the ones I'm most familiar with... Linux not so much).
The OS FAQ has this to say about microkernels with regard to preemption:
And...In theory, this concept makes the kernel more responsive (since much functionality resides in preemptible user-space threads and processes), and improves the stability of the kernel by reducing the amount of code running in kernel space.
This leads me to the conclusion that one of the main benefits of the microkernel approach is its simplicity. The idea being that microkernels are supposed to have such short code paths, that the cost of these paths being non-preemptable, in terms of latency, is negligible. I remember reading something to that effect in the documentation for an older version of QNX Neutrino (www.qnx.com). Unfortunately, that doc is now in the great bit bucket in the sky.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.
However, the latest version of Neutrino (which still qualifies as a microkernel AFAICS) is pre-emptible. So... what gives? It makes sense, given that it's a real-time OS and has to make pretty strict latency guarantees. But I thought pre-emption would be sort of redundant for a microkernel.
Opinions...? Is it worth the added complexity?
It seems to me that this is an important design decision to make early, since it affects the way control flow in the kernel is structured.
Finally, a bit of background on my design goals:
- Will support SMP eventually
- Implemented on x86 initially, but will be portable
- Not specifically aimed at real-time stuff, but low latency is important for general responsiveness.