4 ms·
A few months ago I went through xv6 on my own as an experiment in getting better at systems programming. I wrote a bunch of posts about it, in case people are i
by oskarth 11y ago
A few months ago I went through xv6 on my own as an experiment in getting better at systems programming. I wrote a bunch of posts about it, in case people are interested:
Grokking xv6: http://experiments.oskarth.com/unix00/ http://experiments.oskarth.com/unix00/
What is a shell and how does it work?: http://experiments.oskarth.com/unix01/ http://experiments.oskarth.com/unix01/
What's on the stack?: http://experiments.oskarth.com/unix02/ http://experiments.oskarth.com/unix02/ (video of tracing a system call from user space to kernel space and back: https://www.youtube.com/watch?v=TWksEdn5eoA https://www.youtube.com/watch?v=TWksEdn5eoA)
Page tables and virtual memory: http://experiments.oskarth.com/unix03/ http://experiments.oskarth.com/unix03/
Locks and concurrency:
http://experiments.oskarth.com/unix04/ http://experiments.oskarth.com/unix04/
A short overview of the file system:
http://experiments.oskarth.com/unix05/ http://experiments.oskarth.com/unix05/
Grok LOC?
http://experiments.oskarth.com/unix06/ http://experiments.oskarth.com/unix06/
It was a very educational experience for me, and I highly recommend the journey for other people.
- pmilot 11y agoThank you for this. I know what I'm reading for the next two months! In your original post, you mention one of the goals being able to contribute a patch to a modern OS such as BSD or Linux. After your experiment, do you feel like this is the case?
- oskarth 11y agoGlad it was useful and motivating! This one I feel a bit bad about, because I wanted to write a patch and test that hypothesis, but I didn't (yet) make the time for it. I feel like I could after maybe ~30h (really I don't have enough information to determine beyond it probably being between 10 and 100 hours) of focused effort. I did read a bunch of The Design and Implementation of FreeBSD and I felt like I could understand it reasonably well, using the mental models I picked up studying xv6. The reasons why I didn't do it (yet) are interesting in themselves. There was nothing in particular that I felt was missing from FreeBSD, and I hadn't used the "advanced" parts of the OS enough to run into any bugs. Because of this I think I lacked a sense of ownership, and the artificiality of a bug hunting activity caught up to me, motivation-wise. To do this I think you need to be motivated to dive into the nitty-gritty of a particular part of the OS, in addition to having a good understanding of the OS as a whole. Instead I ended up exploring some of the more advanced parts of FreeBSD (Jails and ZFS) with http://experiments.oskarth.com/netpowder/ http://experiments.oskarth.com/netpowder/ - hopefully I will find something useful that I want to either extend or a bug I want to fix, or perhaps I get to test the hypothesis with something completely different (such as Mirage OS).