Live data from Hacker News

Xv6, a simple Unix-like teaching operating system

pdos.csail.mit.edu

1–10 of 23 posts

Re: Xv6, a simple Unix-like teaching operating system

#3
Formerly:

https://news.ycombinator.com/item?id=22511569

https://news.ycombinator.com/item?id=17592560

https://news.ycombinator.com/item?id=10566312

https://news.ycombinator.com/item?id=7558081

https://news.ycombinator.com/item?id=6971127

https://news.ycombinator.com/item?id=3753216

https://news.ycombinator.com/item?id=2335824

Re: Xv6, a simple Unix-like teaching operating system

#4
This is super interesting -- for folks who are worked on or with this, what makes Xv6 well-suited for teaching OS concepts? What aspects of the OS are less robust / filled out than a standard Linux or BSD distro? I'm curious about the pedagogical considerations behind this OS.

Re: Xv6, a simple Unix-like teaching operating system

#5
post #4

This is super interesting -- for folks who are worked on or with this, what makes Xv6 well-suited for teaching OS concepts? What aspects of the OS are less robust / filled out than a standard Linux or BSD distro? I'm curious about the pedagogical considerations behind this OS.

It's absolutely tiny for one. It has less code than sel4, despite also including a userland and being a monlithic kernel.

It's essientially a stripped down rewrite of what existed in Lion's Commentary on Unix. When you reduce subsystems to around 1KLOC each, it's a lot easier to see the core of what they're trying accomplish.

As for what's missing... a lot. No threads, no mmap (or any way to share memory between processes), only vga, serial, lbs, and ide drivers (in the x86 port), no block devices in the fs, 20 something syscalls total.

Re: Xv6, a simple Unix-like teaching operating system

#6
post #4

This is super interesting -- for folks who are worked on or with this, what makes Xv6 well-suited for teaching OS concepts? What aspects of the OS are less robust / filled out than a standard Linux or BSD distro? I'm curious about the pedagogical considerations behind this OS.

I've taught OS three times using xv6 and like it a lot.

It's very small, which is great. You can print out the entire source code (and there's a makefile target that will produce a printable PDF) and read through it and actually understand the whole system.

At the same time, it has most of the features of an OS that you might want to cover in an intro course:

1. A basic round robin scheduler that you can replace with something more interesting like priorities.

2. A simple FS that still has some advanced features like transactions / crash recovery.

3. Support for SMP, so you can teach issues like locking / deadlocks.

4. UNIX-like system call API, that's again easy to extend to show how a new system call might be implemented.

Off the top of my head, some things it lacks compared to something like Linux:

1. Driver support. Basically only the vga and old-school IDE disks are supported. I've assigned a mouse driver as a final project before and it went pretty well: https://panda.moyix.net/~moyix/cs3224/fall16/bonus_hw/bonus_...

2. Related to (1), this means you aren't going to get anything related to networking.

3. No dynamic linking; every program is static.

4. Anything graphical (although I've seen people do this as a final project)

Re: Xv6, a simple Unix-like teaching operating system

#7
post #4

This is super interesting -- for folks who are worked on or with this, what makes Xv6 well-suited for teaching OS concepts? What aspects of the OS are less robust / filled out than a standard Linux or BSD distro? I'm curious about the pedagogical considerations behind this OS.

I took a OS class with Xv6. As a Linux kernel dev I can tell you Xv6 is great for teaching OS than Linux.

1. I remember the first assignment if the class was adding a new syscall. It was quite trivial task for Xv6 because Xv6 syscall layers is thin and it implements only 300 syscalls.

2. Production grade kernels like Linux is very hard to read for students because they support additional configurations which, for example, are wrapped by a lot of #ifdef macros. Also there are overwhelming number of Arch/hardware support that are not needed for teaching.

Re: Xv6, a simple Unix-like teaching operating system

#8
post #4

This is super interesting -- for folks who are worked on or with this, what makes Xv6 well-suited for teaching OS concepts? What aspects of the OS are less robust / filled out than a standard Linux or BSD distro? I'm curious about the pedagogical considerations behind this OS.

I teach using xv6 and would add a couple more items to what others have already pointed out. They mainly come down to simplifications that remove distractions from the core ideas:

* The system assumes a fixed amount of RAM and a fixed memory layout, so there is no discovery process and no adaptive code to go with it

* The process table is just a small array--no dynamic allocation necessary, and the system can just do a linear search to find an unused entry

* The userspace is simplified. There is a single stack (no threads) of fixed size, mapped memory starts at address 0, and memory is layed out so that only a single number is required to track the size of the entire address space: the size is the top of mapped memory.

Simple data structures are used everywhere, and the emphasis is always on clarity, not efficiency or flexibility.

Re: Xv6, a simple Unix-like teaching operating system

#10
post #3

Formerly: https://news.ycombinator.com/item?id=22511569 https://news.ycombinator.com/item?id=17592560 https://news.ycombinator.com/item?id=10566312 https://news.ycombinator.com/item?id=7558081 https://news.ycombinator.com/item?id=6971127 https://news.ycombinator.com/item?id=3753216 https://news.ycombinator.com/item?id=2335824

[deleted]
Post reply on HN