A couple people have asked me why I’m taking a course on operating systems this term. Presumably they ask because I’m officially studying math and systems programming is very un-theoretical. But there are a couple reasons why I think it was an awesome decision. The first (which needs no explanation) is that it’s definitely the best-taught CS course I’ve taken. The second, and more interesting, is that it’s really helpful to learn how abstractions work in practice.

Operating systems and math classes are both fundamentally about building towers of abstractions that let you do increasingly complex things. In math, this manifests as extremely general tools like category theory, while in operating systems we end up with incredibly deep functional stacks.

Either way, the idea is that at each level, you bundle together ideas that work at lower levels in clever ways that essentially compress a lot of work into something that is easier to fit in your brain, but just as effective. Because humans don’t have much working memory, we can think much more efficiently once we’ve compressed the ideas we’re using.

For example, without high-powered mathematical abstractions we would never have been able to prove something like Fermat’s Last Theorem. It might be technically possible to give an “elementary” proof, just by expanding out all the abstractions that the proof uses into basic statements about the natural numbers. But that proof would be even more monstrous than our current one—so huge that nobody could have actually come up with it. Similarly, programmers could never get anywhere if they had to rewrite libc every time they wanted to copy a string.

The difference is that mathematicians don’t have to actually execute the tools in their proofs. So they’re free to pick abstractions based solely on expressive power. On the other hand, if you write an operating system, you have to worry about all the practical difficulties associated with your abstractions: are they easy to implement? What’s the performance overhead? How much will they they leak? These are issues that get swept under the rug in math. But if you want to write code that does hard things fast, you have to be comfortable with thinking at every level of abstraction in your computer, from electrons moving around your processor up to something like a Python interpreter. So I’m excited to get the practical take on abstractions this semester.

## Comments