I built a microkernel from scratch in Rust (5-part series: boot, IPC, preemption, virtual memory)
Posted by amitbahree@reddit | programming | View on Reddit | 16 comments
I had some free time between jobs and finally did something I’d wanted to do for years: build an OS kernel from scratch.
I mostly work in AI/ML these days, but I wanted to revisit the fundamentals and better understand what’s underneath the abstractions we use every day.
So I built a small microkernel in Rust and documented the journey.
By the end, it boots on an emulated ARM machine, handles task communication, supports preemptive scheduling with interrupts, and enables virtual memory with page tables + MMU.
The most interesting takeaway for me: modern systems concepts feel “magical” until you build even a minimal version yourself. Then you realize they’re just layers of careful engineering and tradeoffs.
Start here (Part 0): https://blog.desigeek.com/post/2026/02/building-microkernel-part0-why-build-an-os/
GitHub repo: https://github.com/bahree/rust-microkernel
Part 0 has links to the full 5-part series at the top and bottom if you want to follow the whole build from boot to virtual memory.
I’m not an OS expert, just sharing what I learned in case it’s useful to other curious devs. 😊
programming-ModTeam@reddit
Your post or comment was removed for the following reason or reasons:
This content is very low quality, stolen, or clearly AI generated.
Relative-Scholar-147@reddit
Sloop, nothing interesting on the article good luck promoting yourself the same way million other losers do.
programming-ModTeam@reddit
No content written mostly by an LLM. If you don't want to write it, we don't want to read it.
jefwillems@reddit
Just so you know, the prev and next buttons are reversed at the bottom of your site
singron@reddit
You might want to mark the x86 support as unfinished somewhere. I'm more familiar with x86 so I was browsing that part of the code, and it was essentially entirely empty, and the bootloader just uses the bootloader_api crate.
All the interesting code is in arch_aarch64_virt.
I think this was probably fun and it seemed like you probably learned a lot, but I'm not sure I would call this a microkernel. It's really a bunch of independent bare-metal demos.
E.g. if you wanted to write 2 tasks that communicate with IPC, have their own virtual memory spaces, and use preemption, you would have to abstract and combine the functionality from a bunch of demos that are currently separate. The IPC demo and the preemption demo have completely different schedulers (both oblivious to the MMU), and the page table demo has no scheduler, so using all 3 features at the same time would require writing a new scheduler that combined IPC and preemption while switching page tables for different tasks.
rescuemod@reddit
"I write..." Take a look into .gitignore *Found .claude/ & .cursor/"
bobsbitchtitz@reddit
I was expecting slop but this is pretty cool
amitbahree@reddit (OP)
Thank you 🙏. If only folks actually went and read the series. 🙃
sacheie@reddit
And so it begins
MyraidChickenSlayer@reddit
What?
KindOfPoo@reddit
it
Relative-Scholar-147@reddit
Sloop, nothing interesting on the article good luck promoting yourself the same way million other losers do.
ChemicalRascal@reddit
You might want to fix up that link, OP.
amitbahree@reddit (OP)
Sorry can you help me grok, which one? Start here part 0, or the repo? Or is it the one that that when posting was needed (which also points to part 0)?
ChemicalRascal@reddit
This is a totally malformed link.
You just want the text:
LevelIndependent672@reddit
ipc with no buffering works great in demos and breaks the second you actually need it. thats how you learn why queues exist ngl