7 ms·
Xv6, a simple Unix-like teaching operating system
- jeffrallen 6y agoXv6 is great, I taught an OS course on it at my employer once. One of my colleagues manned to creat a /dev/audio for it and play an MP3.
- loeg 6y agoFormerly: https://news.ycombinator.com/item?id=22511569 https://news.ycombinator.com/item?id=22511569 https://news.ycombinator.com/item?id=17592560 https://news.ycombinator.com/item?id=17592560 https://news.ycombinator.com/item?id=10566312 https://news.ycombinator.com/item?id=10566312 https://news.ycombinator.com/item?id=7558081 https://news.ycombinator.com/item?id=7558081 https://news.ycombinator.com/item?id=6971127 https://news.ycombinator.com/item?id=6971127 https://news.ycombinator.com/item?id=3753216 https://news.ycombinator.com/item?id=3753216 https://news.ycombinator.com/item?id=2335824 https://news.ycombinator.com/item?id=2335824
- deleted 6y ago[deleted]
- alexellisuk 6y agoInteresting, you'd think this didn't meet the "significant new development" criteria to be trending that many times. Also isn't stuff about UNIX popular?
- lordleft 6y agoThis 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.
- monocasa 6y agoIt'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.
- moyix 6y agoI'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_hw.html 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)
- kbumsik 6y agoI 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 < 30 simple syscalls. Imagine you are going to add a Linux syscall out of > 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.
- _russross 6y agoI 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.
- timsally 6y agoYears ago I took 6.828 at MIT which is an operating systems engineering course for which Xv6 was designed. The part I found most useful as a student was the fact that the entire operating system printed out into a nice slim volume. Many significant subroutines fit entirely on one page. To sum up the pedagogical value: Xv6 is an operating system made as simple as possible, but not simpler. After this course I able to translate the skills to real world results in include a small contribution to the Linux kernel, as well as a significant non-public Linux kernel module. I can recommend studying the Xv6 source code and accompanying book to anyone, without reservation. It was a great privilege to have been able to take that class.
- qntty 6y agoLooks like this was recently re-written for RISC-V. Maybe it should be called Rv6 now.
- Koshkin 6y agoOr maybe they can rename the arch to RIXV6 now.
- alexellisuk 6y agoGreat excuse to rewrite user-space utilities - https://github.com/mit-pdos/xv6-riscv/tree/riscv/user https://github.com/mit-pdos/xv6-riscv/tree/riscv/user
- jjice 6y agoMy OS class that I'm currently taking sues Xv6 as a base for learning about OS implementation. The documentation is great and it clocks in under 10K lines if I'm remembering correctly. I'm really enjoyed working with it in class so far.
- axblount 6y agoAre there any other good minimal teaching operating systems out there? Unix-like or not.
- guerrilla 6y agoMINIX before version 3. There are books by Tanenbaum (and I think others?) that use it to teach operating system design and development.
- cxr 6y agoEven Minix 3 is fairly small. "Operating Systems: Design and Implementation" was synced with Minix 3 in its latest edition (2006). It's all the crud in later releases where things started getting junked up, after Tanenbaum got a windfall of cash, gave his students the keys to the kingdom, so they ended up importing large parts of NetBSD, sloppily. Say hello to 3-hour build times and a codebase that no one contributes to anymore.
- vips7L 6y agoYeah after I read OSTEP and felt like I understood xv6 enough I tried to move on to minix 3 and reading tanenbaums book. I couldn't do it. There was just so much going on.
- loeg 6y agoWindows NT was used in my university's Operating System course (in 2010).
- harry8 6y agoos161 http://os161.eecs.harvard.edu/ http://os161.eecs.harvard.edu/
- ngcc_hk 6y agoCan it work with fpga etc. so still learning but one learn more. Also with general pin in out more scope. Not just IT
- Rotten194 6y agoIf you're interested, I wrote a blog post a few years ago about how to implement a syscall (getcwd) on Xv6: https://vgel.me/posts/pwd_command_xv6/ https://vgel.me/posts/pwd_command_xv6/