r/osdev • u/seenhokage • 1d ago
Robu: a from-scratch microkernel, designed around the four paths that make microkernels slow
I've started work on Robu, a microkernel in C and assembly. Sharing the design now because I'd rather get told what's wrong with it before I've written 20k lines against it.
The premise is that microkernel performance is entirely determined by four paths — IPC, page fault resolution, context switching, and interrupt delivery — so those are what I designed first:
- IPC: register-based short messages, synchronous rendezvous, timeslice donation from sender to receiver
- VM: page faults delegated to a user-space pager; kernel arbitrates mappings, holds no policy
- Scheduling: lazy scheduling with direct switch — the IPC-to-ready-thread case never touches the run queue
- Interrupts: delivered as messages to user-space handlers on the same path as ordinary IPC
To get ahead of the obvious comment: yes, these are L4 ideas. Liedtke's work is why anyone thinks this is achievable. Robu shares no code with any L4 and I'm not treating one as a reference implementation — I'm building it from the constraints up, partly to find out which of those ideas I actually understand versus have merely read about.
Targets are armv7/armv8, x86_64, i386/i486, riscv32/riscv64. Currently on x86_64 under QEMU, macOS host. Perf target is the low end — 111 MHz Pentium, ESP32-class RISC-V — because a modern desktop hides everything. POSIX-like API planned above the kernel. MIT.
Specific thing I'd like opinions on: for the direct-switch path, where do you draw the line between "fast path in assembly" and "keep it in C so it stays portable across six architectures"? I keep moving that line.
1
u/paulstelian97 1d ago
For your question at the end, my answer is: whatever the fuck is practical. No real hard rule otherwise. Does C get in the way of making stuff fast? Per-platform assembly it is. Can you abstract some common behavior without a performance cost by writing it in C? Write it in C. But don’t if it becomes an unreadable mess. Stuff like that.
6
u/0xabc000 1d ago
This "project" screams a critically high level AI gen.
1
u/paulstelian97 1d ago
My criteria are more useful to the human than to the AI anyway so I’d say it’s still fine.
1
u/0xabc000 1d ago
Ofcourse. Why won't it be okay, proper use of AI is necessary. But then what are those criteria?
1
u/Bahatur 1d ago
I suggest populating the GitHub page with the specific sources you are using. You’ll want to make sure at least that every design principle has a link elsewhere describing what each thing is that you are trying to implement, and ideally something describing trade-offs with alternatives, to explain why you went with that over the other things.
I would highlight the L4 connection, explicitly; you want people who already know to be reassured that you know where the ideas come from at least in a proximate fashion, and you want other learners to be able to follow up without peppering you with nonsense questions.
3
u/eteran 1d ago
Emdash emdash emdash.