Hacker Timesnew | past | comments | ask | show | jobs | submitlogin
A Commentary on the Sixth Edition Unix Operating System (warsus.github.io)
153 points by colinprince on Dec 12, 2017 | hide | past | favorite | 16 comments


Had to go find the famous "you are not expected to understand this" comment in the context-switching section.

Looks like it's at line 2238 if anyone is interested in taking a look at it and the code that we are so famously not required to understand.


There's a cool Systems We Love talk about that:

https://systemswe.love/archive/san-francisco-2016/you-are-no...


What was that about? Any link for background story?


See this: http://9p.io/who/dmr/odd.html

The crucial thing to note here is that the second comment (the famous one) has nothing to do with the text above about the savu. So we don't even understand 'You're not expected to understand this'.

As dmr explained there was a problem with stack switching when they ported UNIX to the Interdata because stacks of different functions weren't necessarily compatible, and switching out the stack of a function was a bad idea. For this reason you see dummy variables declared in the Interdata port so the stack layout of different functions would match. On the PDP-11 all stack frames were compatible so this was less of a problem. As dmr said, this was cleaned up in v7.

The comment above it is a different matter. The stack is normally saved in u_rsav (iirc) but this is overwritten when a process is swapped out. In that case the stack to restore is saved in u_ssav. This same behaviour is still in v7 and yet the 'not expected' comment is gone. This is what Lions explains somewhere in his book.


That comment was supposedly put in the code for an intern who was still learning about the system. "You are not expected to understand this", as in, "this will not be on the test".


The comment was put there by Dennis Ritchie to state that the context switching code was hard to understand. It depended on the hardware of the PDP-11. He wrote that comment to indicate that it was complex, buggy, and that they didn't quite fully understand the code either.

https://thenewstack.io/not-expected-understand-explainer/


Thanks, I should have googled before replying.


Your comment has many subtle implications.


I learned C and the Unix kernel from Lions’ Commentary. I still have a licensed original copy. I should find a good library for it. The Computer History Museum already has a copy.


The Internet Archive has Lions' "Experiences with the Unix Time-Sharing System" [1] Would they be interested in your copy of the commentary?

[1] https://archive.org/details/experiences-with-unix-tss


Dang, brings back amazing memories of seeing the Unix source listings on my office mate’s desk in the Aiken computer lab.

I think Harvard got the first official copy outside of Bell Labs in about 1973 or 4. Memory vague.

It was first used on an 11/45 to run the Intro to Programming course for the hoi polloi, running an interpreter for the PPL language, a local higher level language invented by Chuck Prenner as assisted by Al Spector, who was in my class and who ended up as IBM’s chief scientist of some stripe.

It was also used by Peter Langston to write one of the first (the first?) Empire games. It was so engrossed by that I think Peter and others eventually dropped out after getting lost in it.

There’s something very special about those early C listings. We already used Bliss-10 and -11 from CMU, but C was clearly a different take on low level systems programming.


What was obvious to us in that class of 1974 at UNSW was that when we were allowed to power down the PDP at 5pm from the Dec OS running 3 terminals and insert the Unix's RK05, we could run 30 terminals doing the same stuff. We weren't put off by it crashing about every hour, only encouraged to fix it, but we all pretty much in my opinion were defensive about all the heavy criticism from the establishment and the lack of time to explain much.


From the introduction: "The co-operation of the “nroff” program must also be mentioned. Without it, these notes could never have been produced in this form. However it has yielded some of its more enigmatic secrets so reluctantly, that the author’s gratitude is indeed mixed. Certainly “nroff” itself must provide a fertile field for future practitioners of the program documenter’s art."

Had he waited another year, he would have had access to TeX...


Amazing. I love this structure.


Why does the code start at line 100?


(1977!)

Only 13 signals.




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

Search: