Skip to content(if available)orjump to list(if available)

The little book about OS development

vishnuharidas

This took me a nostalgic dive back to 2000's when a website called planet-source-code.com was popular among the developer community. It had hundreds of mini operating systems written by members. Most of them were written in C/C++ and Assembly for the bootloader, compiled using Mingw32, and booting from a regular Floppy disk.

rocky_raccoon

I love osdev. I don't know what the end game is for me, but there's something really cool about being able to just create... whatever I want. It all sort of clicked for me when I was able to get some basic x86 interrupts and syscalls working. Once you get the syscalls going, the world is your oyster!

Seriously, I would highly recommend tinkering around with a hobby OS. I used it as an opportunity to learn Rust and I got more than I bargained for. Now, I feel somewhat comfortable in Rust AND I can throw more double and triple faults than most people in the world.

endorphine

Did you use a book or similar resource? I vaguely recall there was some book about implementing an OS in Rust.

ibobev

Here are some other tutorials about operating systems development including some in Rust programming language: https://github.com/bobeff/programming-math-science?tab=readm...

netbsdusers

Unfortunately this book has the classic fault of osdev tutorials: lots of talking about x86 minutiae, very little osdev. X86 minutiae is not osdev. It is a vanishingly small portion of what even a basic OS has to deal with.

initramfs

Without knowing much about the type of OS this book is, I imagine that there a lot of architectural aspects of x86 are considered "standard" to many of the x86 OSes out there. I hear a lot about code density in the x86, MIPS, and SH-2, compared to a lightweight RISC processor. Or, the book glazes over some of the more universal aspects of OSes, to address specific features of x86.

dokyun

It would be great if there were more hobby OS resources targetting something other than X86. It is common and everything, but all the bootstrapping and device cruft involved isn't something you should need to get in your head, and 386 assembly by itself is terribly frustrating and obtuse to write by hand. I think most people might be better off starting out with a RISC microcontroller. There isn't nearly as much bullshit involved between getting a running kernel and talking some simple serial, and you can get an instruction set reference, assembler manual, and processor datasheet that will tell you everything you need to know. And it's easy to have fun hardware hacking that way too, making your own peripherals and such.

anta40

Perhaps this one: https://github.com/mit-pdos/xv6-riscv ?

The old xv6 is x86-based and it's not officialy maintained anymore.

Or Xinu: https://xinu.cs.purdue.edu. There's a BeagleBone (ARM) port.

dist1ll

True. I'm guessing it's the same reason that lexing and parsing are the focus of many langdev guides, despite being amongst the smallest/simplest parts of the compiler. I guess it makes sense, since those topics are the entry point into the field and at some point your learning is mostly self-directed.

01HNNWZ0MV43FF

I wonder if I could learn anything interesting by making a user space machine agnostic os using some VM like wasm that allows for preemption

bschmidt910

[flagged]

quotemstr

People talk in hushed and revenant tones of SICP despite it having little to do with modern computing architecture. Perhaps x86 is still a great way to cut one's teeth.

charcircuit

The issue is not that x86 is mentioned. It's just that there is a lot more to an operating system than just getting code running on a CPU.

RPC, the input stack, the graphics stack, the network stack, audio, profiling, telemetry, scheduling, UI toolkits, security, service management, application management, etc.

If you want to learn these things you will need to read the documentation and source code for other OSs.

anta40

Real world OS is without no doubt complicated.

But for beginner, I think xv6 is sufficient: https://github.com/mit-pdos/xv6-public

A rather small codebase, pretty well documented, easily buildable without building your own custom GCC, docker etc etc

xmprt

My favorite OS book (less about development and more about how it works) is Operating Systems: Three Easy Pieces. Free in HTML and PDF form but they sell a printed book as well. https://pages.cs.wisc.edu/~remzi/OSTEP/

servercobra

Ahh my favorite professor and favorite class at UW. Remzi is great.

drudolph914

just got recommended this and read a good chunk of it! it’s a great read

dlachausse

Thank you! This looks like a great resource on the topic.

I wish I still had the source code for the “OS” I made as a teenager. I got as far as writing an MBR boot loader, switching to protected mode, displaying characters on the screen, and keyboard input. I highly recommend it if you’re looking for a fun challenge.

shpongled

Writing my own "OS" (read: mostly copying from the OG Bran's Kernel Development Tutorial [1]) was also a formative experience for me as a teenager. Really great way to learn systems programming and what goes on under the hood!

[1] http://www.osdever.net/bkerndev/Docs/gettingstarted.htm

rubiquity

Same! Implementing an OS as a toddler had a profound impact on me. I got as far as needing an SSL implementation and then realized I should probably go get my parents.

rocky_raccoon

Is reddit leaking through to HNews? This childish comment doesn't add any value to the discussion whatsoever.

LPisGood

Are you implying GP’s story is an exaggerated brag?

qingcharles

Ha! Same. Lost the code too. It was fun actually booting something into bare metal. This book helped a lot:

https://www.amazon.com/Developing-32-Bit-Operating-System-Cd...

furkanonder

The book is good. I wish they would look at the issues on GitHub, there are some things that need to be fixed. The last commit was 10 years ago.

initramfs

Now, where's the instruction manual for the little red OS book? https://en.wikipedia.org/wiki/Kylin_(operating_system)

vibrantrida

There are two Japanese operating system development books I wish have English translations because they take you as far as getting a graphical environment with windows working [0], one of the books is even a 30-days challenge of sort [1].

Here is someone's take on MikanOS [0] https://github.com/uchan-nos/mikanos

And another one on 30-days Homemade OS [1] https://github.com/kamaboko123/30daysOS

An attempt to translate "30-days Homemade OS" [1] to English but it didn't get far https://github.com/handmade-osdev/os-in-30-days

I do not know of any English book nor article that go this far, except Fusion but the graphical environment chapter is not done yet [2]

[0] https://www.amazon.co.jp/dp/4839975868 - MikanOS

[1] https://www.amazon.co.jp/dp/B00IR1HYI0 - 30-days Homemade OS

[2] https://0xc0ffee.netlify.app/osdev/ - Fusion, an OS made in Nim

khaledh

Fusion author here. I haven't abandoned the project, and I do plan to complete it, including a graphics subsystem and a network stack. I'm currently trying to crack a tough nut, which is efficient zero-copy IPC using message passing over channels with a shared heap. This is a fundamental piece that will be used to communicate between different components (both within the kernel and across kernel-user space). Once I have a proper implementation, I expect the pace to pick up.

And of course I will document everything as I make more progress.

fragmede

Speaking of OS development, games make learning fun. I had the idea of making a game to teach operating systems while taking a journey through the history of computers. The player would play the part of the process scheduler and interrupt handler, starting on a single CPU system with very limited RAM, before growing to SMP systems then maybe getting to multi-system distributed computing platforms that we have today.

markus_zhang

I have thought about making a game or a Fallout 3/4 mod in which the player needs to assembly pieces to repair a broken vintage computer before the nuclear war, and then search for some manuals and write programs to solve quests.

SoothingSorbet

That sounds fun. I tried to design an assembly game once, but found I lack the creativity to design puzzles/goals that are not just "implement this common algorithm in assembly language". The idea of bootstrapping a PC from virtual firmware and writing an OS sounds nice, though.

zelphirkalt

A little (ha) bit of confusion with "The Little ..." series, with that title.

bschmidt806

[flagged]

bschmidt756

[flagged]