Hacker News new | ask | show | jobs
Xv6, a simple Unix-like teaching operating system (pdos.csail.mit.edu)
125 points by rspivak 2299 days ago
8 comments

Similar teaching operating systems include:

Blog OS, an operating system written in Rust constructed through a series of independent tutorials.[0]

The CS140E embedded operating system.[1] This OS comes from an experimental course taught by Dawson Engler at Standford. The instruction is lab-based with no lectures. The student builds the OS on a Raspberry Pi through the use of primary-source technical references like datasheets and ARM manuals.

[0] https://os.phil-opp.com/ [1] https://github.com/dddrrreee/cs140e-20win/

The nice thing about xv6 is it gets a lot farther to be a full OS. User mode, ELF loader, an ascetic but usable system call table, etc.
If you want an even fuller OS for teaching purposes, early versions of Minix were designed with teaching in mind, and there’s a book to go along with it.
Yeah, but they used a much more confusing architecture for early Minix (16-bit protected mode) that I'm of the opinion it obfuscates a lot of the underlying concepts.

And xv6 has a book that goes along with it as well.

also, don’t forget about [0] (another rust-based learning mini for risc-v)

[0] http://osblog.stephenmarz.com/

PintOS is also a nice learning OS that's been used in classes. It is initially incomplete and there are 4 projects to implement process schedulling, paging, files. It simplifies the learning process since the hardware related initialization code is already implemented and is readable enough to be understood, while allowing you to focus on implementing the main ideas in OSs. Currently I'm doing project 1 on my own. It would have been really nice if my university offered me something like this, to have instructor feedback.
Russ Cox was involved in this, and also Go. There are important connections between them.
Russ cox also wrote re2, an awesome regex library using finite automata, and providing protection against regex match taking exponential time.
>regex library using finite automata

Ehh

>>regex library using finite automata >Ehh

By which you mean?

I remember learning RE in the context of finite automata so I'm gathering that they are questioning the novelty of that implementation strategy?
It's essential to it. Literally computer science 101
Exactly
Regex is equivalent to Finite Automata
The MIT Operating Systems opencourseware class labs has some great exercises when learning about operating systems[0]. I've also found older linux kernels, like v1.0, are easier to follow for learning [1].

[0]https://ocw.mit.edu/courses/electrical-engineering-and-compu...

[1]https://mirrors.edge.kernel.org/pub/linux/kernel/v1.0/

For some purposes, I wonder if OpenBSD would also be a strong candidate for learning about operating systems, given their focus on correctness, openness, portability, etc., and the fact that everything learned then becomes useful on a fully general-purpose OS that one could use in the long term (ie, lots of headroom, less need to start over for learning some things, somewhere else).

The quality and good order of the documentation in particular makes it less or not necessary to go doing web searches etc to find out how to do things, but they take one in an orderly progression from installation, via FAQs and excellent manual pages, all the way along to useful development info.

OpenBSD is huge (just like any general-purpose OS would be today). It's not a "teaching OS."

Minix would be a better alternative, IMHO.

agree - possibly any of the BSD's might be a good follow up for 'advanced' study since the codebase & kernel structures have a direct lineage. Maybe doing the 'base' course on like 4.2BSD which is still smaller and close to v7 might make sense
4.4BSD-Lite2 is the earliest they could do without risking some legal issues[1].

[1] https://virtuallyfun.com/wordpress/2018/11/26/why-bsd-os-is-...

Minix is still huge compared to xv6
Apparently noteworthy because late last year they ported the original x86 to RISC-V.
What am I supposed to do with it?
The included textbook is _really_ good introduction to systems programming. I highly recommend taking a look if you are interested in kernel programming or interaction between OS.
thank you, that's useful information of what this is.
Learn about Unix internals on something much smaller than the available alternatives?
like literally, i was asking for instructions. neither this post nor the github repo offered any instructions of what one is supposed to do with this, aka, how to build it, how to run it, or what to learn.
Ahh, ok. I wasn't trying to be snarky, just pointing out that it's quite small and easy to fit in your head.

It seems disconnected because it's the repo for the port to RISC-V. The instructions you're looking for are here for the original x86 port: https://www.cs.virginia.edu/~cr4bd/4414/F2019/xv6intro.html

Thank you, that is precisely what I was looking for.
In addition to teaching, it's been used as the core of a couple proprietary OSes for small envs. I think at least one TEE monitor is a heavily modified xv6.
not sure what all the downvotes are for - it was a legitimate question. The instructions just say to clone the github repo. The github repo just says it's for learning - no instructions.

How is one to learn without instructions? Or it only to teach those whom already know the answers?