Three and a half years ago, I wrote about what is arguably the most famous comment in computer history. That, of course, is the celebrated “You are not expected to understand this” comment in the V6 Unix source code. The comment appears in the process-switching code and was meant to convey that what was going on was particularly hairy.
I just came across a reference to a post from 2018 by Paul McLellan that also discusses the comment. What’s interesting about the comment is that it’s often interpreted as snark but, in fact, was simply meant to convey that the code was very hard to understand. Indeed, Thompson and Ritchie later confessed that they didn’t understand it either. It worked only because of peculiarity of the Unix PDP-11 compiler. When Unix moved to other architectures, the code no longer worked and was rewritten leading to the disappearance of the comment.
McLellan does a good job of explaining what was going on in the code and why it was so difficult to comprehend. If you think that none of this concerns you, you should think again. A necessary part of learning to write code is to read code and V6 Unix is some of the best code you can read. It will show you how the masters did it even if you aren’t writing an operating system.