Compute Like It Is 1975: 6th Edition Unix Reborn

If you crave experiencing or reliving what computing was like “back then” you have a lot of options. One option, of course, is to load an emulator and pretend like you have the hardware and software you are interested in. Another often expensive option is to actually buy the hardware on the used market. However, [mit-pdos] has a different approach: port the 6th edition of Unix to RISC-V and use a modern CPU to run an old favorite operating system.

It isn’t an exact copy, of course, but Xv6 was developed back in 2006 as a teaching operating system at MIT. You can find resources including links to the original Unix source code, commentary on the source code, and information about the original PDP 11/40 host computer on the project’s main page.

In addition, you might find the book about Xv6 of interest. We know you probably don’t want to use 1970’s-era Unix as your daily operating system, but you can learn a lot by even reading either the original code or the more up-to-date Xv6 source. It also isn’t a bad way to understand RISC-V internals.

Several computer science operating system classes use Xv6 in one form or another. You can see one of several lectures about it from Harvey Mudd College, below. We’ve covered RISC-V for a while because we like its openness. Not to mention, the CPU doesn’t have to be complicated.

12 thoughts on “Compute Like It Is 1975: 6th Edition Unix Reborn

  1. Version 6 was especially fun in that it did not have FSCK. Checking and repairing a filesystem was a good deal more diffiicult and required training. Reconnecting a detached directory had to be done using the debugger to patch filesystem data structures.

    1. With debugger; you mean fsdb (the file system debugger)? I had to do that once (after some problem apparently zapped a directory, or, possibly, a hole track on that disk). Took me a day or so to get things sane. I’m glad I never had to do that again.

    2. I remember using icheck and dcheck instead of fsck on the 6th edition. However, it was the programmer’s workbench version, maybe not entirely pure 6th edition. Also, that was in 1979 and it was a “commercial” version from Integrated Systems Corporation (ISC) that was based in Santa Monica.

    3. That’s the sort of tedious thing I’d do once before writing a tool to make it easier. I must have a hundred short tools for DOS and Linux I’ve written over the years because I’m too lazy to do something that feels boring. Of course I don’t have a manual for any of them either because that’s also really boring to do.

  2. The article needs to be updated to reflect that Xv6 is a *reimplementation* of 6th edition Unix, not a port. As far as I know, no original Unix source is used in Xv6 and only a subset of the v6 functionality has been implemented.

    Nowadays it is trivial to run the original PDP-11 v6 in emulation, and there are a number of resources online to help with this (check out https://gunkies.org/wiki/Running_UNIX_v6_in_SIMH). If you’re patient, you can also piece together a real PDP-11 (e.g. a bare-bones 11/23) for relatively little money and run a stripped down version of v6 that doesn’t require MMU hardware (http://ana-3.lcs.mit.edu/~jnc/tech/unix/Mini/Mini.html).

    Also, those playing around with Xv6/v6/Mini-Unix might be interested in my retro-fuse project (https://github.com/jaylogue/retro-fuse). It makes it possible to mount original v6 filesystem images under Linux or MacOS for both reading and writing. It actually incorporates portions of the original v6 kernel code (lightly modernized), which helps to ensure block-level fidelity of the filesystem structure.

    1. Xv6 is sort of a replacement for the Lions’ Commentary on UNIX 6th Edition. The Lions book is great, an still relevant for many, but ultimately it’s difficult for a student to get a working toolchain and target system even in emulation. It’s definitely possible as you’ve demonstrated (thanks for those links!), but I don’t think it’s worthwhile for a neophyte kernel developer to venture down that path. It’s important to remember that Xv6 is not here for retro-enthusiasts or computer historians, it’s an educational tool.

      Xv6 resolves the toolchain and target issue while also providing a kernel of similar complexity and structure to the 6th Edition. But I strongly agree that it is a misnomer to call it Xv6 a 6th edition.

      There are quite a few Xv6-related projects and extensions on github and gitlab. Such as adding virtual memory and paging or BSD sockets. I think it makes a good framework for undergrads to accomplish some meaningful projects in operating systems development.

    2. I wrote my own PDP-11/40 emulator for microcontrollers (runs on AVR, SAMD21, SAMD51, and easily portable) in about 8 weeks, they’re fairly simple machines, really.

      At the moment it doesn’t run many OSes due to lacking emulation for some PDP-11 hardware options/drives, but it can run a complete UNIX V6 RK05 image without issue. MIPS on the SAMD51s is actually every so slightly higher than the real thing. (Repo currently private while I fix stuff). I’ve made a couple of modifications to my UNIX image, like adding the shutdown command, but it’s mostly stock.

      Your retro-fuse is literally what I was looking for when google pointed me this way! Awesome! Thank you :)

Leave a Reply to Dare Cancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.