Pinion - a kernel for your kernel
Posted: Fri Apr 13, 2012 1:54 am
Hi,
As part of this project, I've written a sort of microkernel that, unlike a normal microkernel, is designed purely to do memory management and threading for a larger monolithic kernel, which runs under it in ring 1 (but with full IO privileges.) It is only written for single-processor x86, but there is nothing in the ABI that prevents things like SMP; the semantics are also general enough that ports for other architectures could be easily developed. The idea is to have a common base that contains all of the tricky parts of the OS but imposes no real constraints on the rest of the kernel, and that also has a very well-defined ABI, so other implementations following the specification can be drop-in replacements. Basically, an "OS engine" in the spirit of a game engine.
Since it seems like it could be legitimately useful for other hobby OS developers, I've set up a separate project called Pinion to contain the specification for the ABI as well as this reference implementation. The reference implementation contains a lot of Rhombus kernel code, which has been tested pretty thoroughly, and the new threading model is based on (and checked against) a formal state machine.
I'm not officially releasing the draft of the specification and the full documentation until April 19. At that point, I'd really like feedback on this, especially from people who might actually like to base a new system on it. My new project will use it, and I will likely backport Rhombus to it, so it should be actively developed for quite a while. It's also effectively complete even at this point, so there is no danger of vaporware.
Before then, feel free to ask any questions about the design here.
Some features of the design:
- Preemptive multithreading in both kernelspace and userspace
- Ability to pause threads and inspect/modify their states
- Handling of stack overflows/page faults/GPFs/etc. from kernelspace
- Event queues that multiple threads can wait on (e.g. multiple worker threads can handle one type of IRQ or event in a round-robin fashion)
https://github.com/nickbjohnson4224/pinion
As part of this project, I've written a sort of microkernel that, unlike a normal microkernel, is designed purely to do memory management and threading for a larger monolithic kernel, which runs under it in ring 1 (but with full IO privileges.) It is only written for single-processor x86, but there is nothing in the ABI that prevents things like SMP; the semantics are also general enough that ports for other architectures could be easily developed. The idea is to have a common base that contains all of the tricky parts of the OS but imposes no real constraints on the rest of the kernel, and that also has a very well-defined ABI, so other implementations following the specification can be drop-in replacements. Basically, an "OS engine" in the spirit of a game engine.
Since it seems like it could be legitimately useful for other hobby OS developers, I've set up a separate project called Pinion to contain the specification for the ABI as well as this reference implementation. The reference implementation contains a lot of Rhombus kernel code, which has been tested pretty thoroughly, and the new threading model is based on (and checked against) a formal state machine.
I'm not officially releasing the draft of the specification and the full documentation until April 19. At that point, I'd really like feedback on this, especially from people who might actually like to base a new system on it. My new project will use it, and I will likely backport Rhombus to it, so it should be actively developed for quite a while. It's also effectively complete even at this point, so there is no danger of vaporware.
Before then, feel free to ask any questions about the design here.
Some features of the design:
- Preemptive multithreading in both kernelspace and userspace
- Ability to pause threads and inspect/modify their states
- Handling of stack overflows/page faults/GPFs/etc. from kernelspace
- Event queues that multiple threads can wait on (e.g. multiple worker threads can handle one type of IRQ or event in a round-robin fashion)
https://github.com/nickbjohnson4224/pinion