You Are Not Expected to Understand This

I recently came across a post that explains the famous comment in the 6th Edition Unix source code: * You are not expected to understand this. I haven’t seen or thought about this for years but it was once quite famous and appeared on all sorts of geek paraphernalia. The post describes the comment as notorious but it really wasn’t as flippant as it seems. The code it was describing is very hairy because it makes use of an artifact of a particular compiler for a particular machine. As Dennis Ritchie explained (see blow) this broke when they ported Unix to the Interdata and the code was rewritten.

Rob Pike tweeted that a few years later they understood the problem better and could use simpler code

Dennis Ritchie shows the code and explains (scroll down a bit) what it was doing, what they really meant by the comment, and admits that the real problem (as suggested by Pike’s tweet) was that they didn’t understand the problem very well either. Nowadays context switching is well understood and not considered the least bit hard so it’s interesting to read that real programming gurus like Ritchie and Steve Johnson struggled with getting it right.

If you have the Lions book, you can see the code in its original context (you can get the book here or from Amazon). By the Seventh Edition of Unix the code had been rewritten and the comment was gone.

UPDATE [2017-01-17 Tue 12:04]: There’s a great thread on all of this from the The Unix Heritage Society mailing list.

This entry was posted in General and tagged . Bookmark the permalink.