Hacker News new | past | comments | ask | show | jobs | submit login
Xv6, a simple Unix-like teaching operating system (csail.mit.edu)
171 points by memorable on Aug 2, 2022 | hide | past | favorite | 75 comments



Hello!

I have an antique server with qemu set up to run Xv6.[1] I wanted somebody to go through the course with me.[2] So far nobody has come aboard, and I haven't really started. If anyone here might be interested, please feel free to get in touch: notoles@metalvps.com. It would be super great to have a few friends along! Thank you!

Best wishes and kindest regards,

Tom

[1] https://lowendbox.com/blog/how-to-compile-the-3-items-needed...

[2] https://lowendbox.com/blog/invitation-to-join-me-for-mits-fr...


Earlier today I sent our first Xv6 Study Group email blast to the 15 people who have signed up. Also, I started a simple website for the group:

https://metalvps.com/Xv6/

I wasn't expecting such a big response! Thank you to all the guys who joined! Thank you HN!


Hello again!

Already have one person for our Xv6 study circle! Thank you HN! Anybody else?

I'm going to sleep now, but if anybody emails me, I will for sure reply in the morning.

Best!

Tom


So far, ten people have emailed expressing interest in joining our Xv6 study group. Plus three more said hello.

My idea is to start on the course itself tomorrow or the next day. I expect to invest at least an hour a day in the course itself. I also expect to post my notes and progress somewhere.

We can fill in the group structure as we go along. Maybe we all can keep in touch via email, irc, Jitsi, an HN thread, or set up our own Xv6 study group forum?

I am delighted to be in contact with so many other students! We have room for a few more if anyone else wants to join. Thank you all so much!


Oops! I just checked my email! There seem to be several more responses. I will get back to everyone ASAP.

We might even have room for even a few more!

Thanks guys! Thank you HN <3


Really wish I could join but I'm not there yet, need more work to get there. Good luck and have fun!


Hi Markus!

Thanks for your kind words.

I read your comment[1] which explains what you are doing and suggests by implication why you might think you are insufficiently prepared.

However, no law requires perfect preparedness. Why not take a few small bites of delicious dessert and see how they taste?

Best wishes and kindest regards,

Tom

[1] https://news.ycombinator.com/item?id=32314583


Thanks for the encouragement! I'll grab the textbook and take a look.


For those interested in a slightly more readable code and modern build system, shameless plug of my attempt at some xv6 modernization: https://github.com/NewbiZ/xv6


Is this a fork of xv6? Did you get permission to remove the LICENSE file?


I checked. It's definitely a fork. Eg, compare https://github.com/NewbiZ/xv6/blob/master/fs/fs.c to https://github.com/mit-pdos/xv6-public/blob/master/fs.c .

I didn't find a mention of the original copyright.


My favorite OS tutorial that I recommend to students, which uses Rust to target RISC-V: https://osblog.stephenmarz.com/


Why the downvotes?


I don't get it...GP, thanks for the link.


One of my favorite classes in college was Operating Systems, taught by Peter Fröhlich at Johns Hopkins. We modified and built new xv6 features. Here's the course webpage, with the excellent and fun assignments:

https://www.cs.jhu.edu/~phf/2016/fall/cs318/


I'm working my way through this[1] operating systems book and a few of the exercises[2] require customizing and compiling Xv6. It's so cool to code your own scheduler or syscall and see it working on a actual OS.

[1] https://pages.cs.wisc.edu/~remzi/OSTEP/ [2] https://github.com/remzi-arpacidusseau/ostep-projects


Also, XINU, “ Operating System Design - The Xinu Approach”[0]

The book isn’t free, but I’ve found it to be fun to work through. The projects are centered around building and running on small boards like beaglebone, Galileo, and more recently raspi (although this isn’t covered in the book.)

[0] https://xinu.cs.purdue.edu/


I just scanned the Xv6 book [0] and it seems the book's exercises aren't really to build an OS from scratch, but modify an existing bare-bones OS.

When looking at the Xinu book index, it's not clear to me if the Xinu book is different. Does the Xinu book show how to write an OS from scratch or is the book also about making small changes to an existing OS?

---

[0]: https://pdos.csail.mit.edu/6.828/2021/xv6/book-riscv-rev2.pd...


It's another bare-bones OS.

I've taken the class at Purdue. The way the class works it was divided into 4 "projects" where you had to add features to Xinu. In my semester those were: a more advanced scheduler, locks, process permissions, and a file-system.


Related:

Running a Unix-like OS on a home-built CPU with a home-built C compiler - https://news.ycombinator.com/item?id=24680109 - Oct 2020 (69 comments)

Xv6, a simple Unix-like teaching operating system - https://news.ycombinator.com/item?id=24567993 - Sept 2020 (21 comments)

Xv6, a simple Unix-like teaching operating system - https://news.ycombinator.com/item?id=22511569 - March 2020 (32 comments)

Xv6 for RISC-V - https://news.ycombinator.com/item?id=21040057 - Sept 2019 (8 comments)

Xv6, a simple Unix-like teaching operating system - https://news.ycombinator.com/item?id=17592560 - July 2018 (79 comments)

Xv6, a simple Unix-like teaching operating system - https://news.ycombinator.com/item?id=10798523 - Dec 2015 (14 comments)

Xv6 - https://news.ycombinator.com/item?id=10566312 - Nov 2015 (47 comments)

Ask HN: What are the best resources for learning Operating Systems with xv6? - https://news.ycombinator.com/item?id=8877714 - Jan 2015 (1 comment)

Xv6 – A Simple Unix-Like Teaching Operating System - https://news.ycombinator.com/item?id=8620589 - Nov 2014 (28 comments)

Xv6 - https://news.ycombinator.com/item?id=7558081 - April 2014 (36 comments)

Xv6, a simple Unix-like teaching operating system - https://news.ycombinator.com/item?id=6971127 - Dec 2013 (78 comments)

Xv6 - Unix V6 rewritten in modern, ANSI C for MIT 6.828 - https://news.ycombinator.com/item?id=3753216 - March 2012 (14 comments)

Unix v6 Ported to ANSI C - https://news.ycombinator.com/item?id=3212515 - Nov 2011 (50 comments)

Xv6, a simple Unix-like teaching operating system - https://news.ycombinator.com/item?id=2335824 - March 2011 (4 comments)


Excellent. I'm working on a local undergraduate class chain to reach Compiler, Operating System and Computer Graphics. The school is peanut comparing to MIT so we don't have difficult labs as in MIT or Berkeley's courses. I'll take MIT's after I get the basics from my university. Hopefully this can smooth the cliff a bit.


go bears


I really liked tinkering on os-161 from ops-class.org (Harvard) a few years back. They have a youtube channel with all of the video courses and various assignments including new features and bug fixing.


Last time I looked this didn't have networking. Is that still the case?

Anyone able to explain why networking was left out?

Why I ask? I've seen a bunch of projects on GitHub for implementing xv6 networking.


Probably because it has a lab to add networking: https://pdos.csail.mit.edu/6.828/2019/labs/net.html


The course has a networking lab. There should be a branch with basic support, and an exercise to extend it.


Is it possible to get started on a mac (non intel chip)? I see there's some emulator thing / qemu that only runs on intel or something ...


QEMU runs just fine on ARM macs :) It will emulate an x86 virtual machine that xv6 runs inside.


OK the problem seems to be compiling xv6 then, it simply won't compile without a specially built compiler flags


Why not MINIX?


    $ find minix -name \*.[chsS] | grep -v '^minix/external' | xargs cat | wc -l
     3347361
    $ find xv6-public/ -name \*.[chsS] | xargs cat | wc -l
     9778


MINIX isn't very Unix-like


It actually is Unix-like, and is even POSIX compliant.


Eh, guess it depends on what you're using to compare them. A lot of things are POSIX-compliant. Heck, Windows NT was literally developed because the military wanted POSIX compliance. I consider something Unix-like if it is similar in structure and design to historic Unixes, or at least Linux. MINIX seems to be neither.


Right - for a start xv6 is a monolithic kernel, and MINIX is (mostly) not.


The kind of kernel is NOT a definition of a UNIX. Tru64 UNIX and QNX have Micro-kernels, DragonFlyBSD and MacOS Hybrid.

Tru64 UNIX and MacOS are UNIX certified.

>for a start

https://en.wikipedia.org/wiki/Unix

Varies; monolithic, microkernel, hybrid


> Tru64 UNIX and QNX have Micro-kernels, DragonFlyBSD and MacOS Hybrid.

You're reading too much into my comment. The original PDP-7 (and later PDP-11) Unix are monolithic kernels. The most popular Unix variants or clones today (Linux, Free/Net/OpenBSD) are all monolithic kernels.

Tru64 is long dead. QNX has a niche market. DragonFly ... not much market share. MacOS? As you say, hybrid, not microkernel, and is hardly successful in the same space that the monolithic kernel Unices are (ie. servers).

It's not hard to argue that Unix has historically been a monolithic design, and that those have been the most successful, even if you can certify various microkernels. Of course this comment may not hold for another 50 years, but it is certainly true of the last 50.


I would argue that linux and macos are the most popular.

And its really not my problem if you think a unix has to be mono..thats just wrong and you know it.


> And its really not my problem if you think a unix has to be mono..thats just wrong and you know it.

It's not really my problem if you think I said UNIX has to be a monolith, since I never said that.

Xv6 is a reimplementation based on the original v6 UNIX design. As a teaching tool for the historical design of UNIX, it's a great place to start. If you want to study Unix-like microkernels, then MINIX and Tanenbaum's books are a great place to start.

If you want to study hybrid Unix-like systems, then the Darwin source code might be a good place to start. MacOS as a popular, hybrid, desktop Unix is pretty much an anomaly in the course of Unix history.

Study whatever you want, but for beginners to OS design, it's easier to understand hybrid and microkernel systems if you first know what a monolithic kernel is, and how various modern versions of Unix evolved from that in my personal opinion.

Nobody really gives a rat's ass about UNIX certification in the real world ... except MacOS fans.


>It's not really my problem if you think I said UNIX has to be a monolith, since I never said that.

Sure you said that:

>Right - for a start xv6 is a monolithic kernel, and MINIX is (mostly) not.

>Nobody really gives a rat's ass about UNIX certification in the real world ... except MacOS fans.

Then don't call it Unix, your a liar and i stop here.


I would argue MINIX is the most popular… as it runs in every Intel CPU.


I hear this a lot - but given that consumer choice is pretty much taken out of the equation, I don't really consider popularity to be applicable. People don't buy Intel CPU's because of the Minix ME.


That argument is just stupid...see smartphone rt-os in gsm chips, and btw it runs intel-me, not the chip. You can remove/disable it.


>MINIX isn't very Unix-like

Can you please tell me why do you come to such a wrong conclusion?


I don't know quite what you mean? MINIX isn't free, which is pretty big for a student project. In fact people may have started a similar project(not big like GNU) to due to its price.



My comment as may be noted was more a commentary on the historical licensing of MINIX which lead to Linux, see the original post.

https://fossbytes.com/linus-torvaldss-famous-email-first-lin...


It's reasonable to say it wasn't free, but MINIX 3 is FOSS now.


The same argument could be made to claim "Linux isn't free" given its very first license.


Is there any basic language eg Common Lisp, vim etc that can run on these?


I'm not really sure how I feel about universities (which should be teaching modern technologies and methods) teaching ancient 70s stuff like Unix.

Do we really want a new generation of people who think Unix was born perfect and cannot be improved upon?


Maybe simplicity? Something that can be understood easily in a few weeks, and then you may start implementing whatever features you find useful. Oh, and Xv6 is buildable under 1 minute on modern machine, and don't need a custom-build toolchain.


>Do we really want a new generation of people who think Unix was born perfect and cannot be improved upon?

Yes. "Perfect" may be debatable (what is "perfect" anyway?), but it has lasted over half a century so they must have done something well!


I agree it definitely did lots well, but "it lasted over half a century" isn't a great argument for that. There are huge network effects with platform APIs that allow terrible things to persist simply because that's what everyone else uses.


New things might have been introduced, but fundamentals haven't changed. OS's then and now still have schedulers, memory managers, file systems, etc.


>which should be teaching modern technologies and methods

Ah yeah. Modern=good Ancient=Bad, that's why your car still has wheels right?


My car has wheels with vulcanised rubber tyres, integrated pressure sensors and hydraulic disc brakes. Just like the Romans had right?


It's not better, just for a different use-case. That's why every single universal-os is based in 60-90 tech. Your tires are useless for tanks or trains, but wheels are universal.

Let's see how good your tire's are in a chariot race:

https://www.seeker.com/secret-of-roman-race-chariots-found-2...

>>Any iron tire for racing would be a very thin strip of iron on the outside of the wooden rim, best when heat-shrunk on the wood, to consolidate the whole wheel.

Your base is ~unix=wheel and on top your pressure-sensor=Kubernetes (for example), below is your always on disk-brake=x86 ;)


It sounds like you can't imagine something fundamentally different to Unix. Not everything is built on Unix.

I would suggest looking up how Fuchsia works for example.


>I would suggest looking up how Fuchsia works for example.

I would agree with you...after Fuschsia has proven itself in the real world for a few decades. At this point -it has not.


I would suggest looking up how OpenVMS works for example.

Why learn a Bullshit OS (fuchsia) when you can learn ~unix and cover 90% of usage.

Again Students are not stupid they can read and learn for themselves after learning the basics of a OS...what Xv6 is for.

But maybe you are that hidden genius professor from MIT that could teach everything much better. But then, why do we even talk, right?


Your comment is almost certainly the stupidest thing I have ever read on HN.

I look forward to more insightful comments from you in this vein:

"I'm not sure how I feel about universities (which should be teaching modern history) teaching ancient 27BC stuff like the Roman Empire. Do you really want a new generation of people who think the Roman Empire was perfect and cannot be improved upon?"

I'm sure students would benefit more from MIT running courses such as "7.1729: An Introduction to 23 Not-Invented-Here JavaScript Frameworks" /s


This course isn't a history lesson. That is pretty clear if you read the course overview - https://pdos.csail.mit.edu/6.828/2021/overview.html

> 23 Not-Invented-Here JavaScript Frameworks

We're talking about operating systems. Do you know the difference between an operating system and a Javascript framework?


So teaching c would be a bad idea? Your argumentation is pretty weak...to say it mildly.


Again, for historical reasons it's probably not a bad idea. But yes it would be a bad idea to teach students C and send them out into the world with the idea that writing C is how you're supposed to do it.


>But yes it would be a bad idea to teach students C and send them out into the world with the idea that writing C is how you're supposed to do it.

So your student have to tell Linus:

Sorry cant help you with your kernel that's not how you're supposed to do it, please learn Rust and rewrite your kernel RN! I don't know in what wannabe rainbow world you live.

BTW Students can think for themself, they honestly DONT believe you if you tell them unix or c nor rust are flawless, teaching something does not mean it's perfect but one way to do it.


Actually Linus is on the way to learn some Rust from those students....


Let's see how that experiment works out.


It is already working out on Android, regardless of what upstream does.

https://source.android.com/setup/build/rust/building-rust-mo...


Yes and? What do you want to say?


Exactly what I did, experiment works out.


Those who do not learn history will repeat the mistakes. Not sure you want the whole history it history is important.

Btw for politics essence of decision on many historical lesson are still great.


Ah the book that set UNIX into the wild.


Don't you mean Lions' book and v6?


Yes, and that is explicity referenced in the article under "Unix Version 6" section.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: