If you’re a Unix nerd like me, you probably like reading through the Unix sources. These days, that’s remarkably easy to do. We have Linux, BSD, Open Solaris, and even some of the ancient Unix sources to peruse. It wasn’t always like that. I remember my excitement when the famous Lions Book was finally made available to the public. I ran right out and got myself a copy the same day I heard about it. For those who don’t know, John Lions’ A Commentary of the Sixth Edition UNIX Operating System was a line-by-line exegesis of V6 Unix. For years it was restricted to Unix source code licensees so it was a moment for celebration when it was finally unencumbered.
Today I learned—or maybe relearned—via OS Blog that V6 Unix has been ported to the X86 architecture and ANSI C. The original V6 sources were written in a pre-ANSI C and don’t compile with a modern C compiler. The nice thing about V6 is that it was a small OS (less than 9000 lines) and pretty easy to understand. The downside was that it was targeted at the PDP-11 so most of the low level machine details and the assembly language bits are opaque to younger1 readers.
Now Russ Cox, Frans Kaashoek, and Robert Morris have resurected it for the X86. The system is bootable or you can run it under QEMU. Even nicer, the authors have a commentary to go along with it. It’s not a line-by-line commentary like Lions’ book but it does explain the details of the X86 that you need to understand the code. There’s also a printed version of the code with line numbers that goes along with the commentary.
If you’re interested in learning some of the low level details of Unix-like systems but find slogging through the Linux or BSD code base too daunting, this could be just what you need. It’s a really great resource and it’s all free. If you want to read about the code but aren’t interested in compiling and running it you can just download the two PDFs. If you want the code itself, that’s available too. The code was ported for use in the MIT 6.828 Operating Systems Engineering course and the course notes are available too.
Footnotes:
1 Younger ≡ Not working on computer systems 30 years ago.