I have started building an operating system kernel, from scratch, using a process I call the spec-first method.

First, let's cover the why. Operating systems have been a mysterious black box for me for years. I believe that one of the best ways to truly understand something is to build it yourself. You not only get to learn how something works but also why it was built like that. An OS is also at the heart of almost everything we do with computers. Understanding how it works makes it much easier to reason about the performance, efficiency, security, and durability of the software running on top.

Writing an OS is also something I find a lot of fun. It's exciting to be able to "touch" the registers that are physically on the CPU, move data between them, and produce meaningful work. You are at the edge of the physical and digital worlds. It gives a sense of power but it is also humbling with the complexity that comes from the constraints. It's also really cool for me to start understanding the different things that I have been using for decades.

In terms of the stack, I have chosen to target the RISC-V architecture. I believe its simplicity will make the learning process much more enjoyable. I am also interested in the ISA itself. It can be the hardware equivalent of the thriving open source software ecosystem. I've also chosen to write everything in C (apart from the mandatory assembly, which I am also finding enjoyable). I've been re-reading the K&R book and I find that this way of learning C beats any tutorial or programming experience. I'm basically using C for what it was created for.

In short, I have this convergence of things I want to learn about, operating systems, RISC-V, C, that result in the perfect project: an OS kernel, from scratch. I've already started and have made some small but very meaningful and enlightening progress. As I catch up with the draft posts I want to write about, I will start sharing progress updates with my findings and things I've learned.