4 ms·
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 interes
by sq_ 9y ago
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.
- IncRnd 9y agoYour comment has many subtle implications.
- mayankkaizen 9y agoWhat was that about? Any link for background story?
- nerflad 9y agoThat 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".
- sparcpile 9y agoThe 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/ https://thenewstack.io/not-expected-understand-explainer/
- nerflad 9y agoThanks, I should have googled before replying.
- aap_ 9y agoSee this: http://9p.io/who/dmr/odd.html 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.
- santix 9y agoThere's a cool Systems We Love talk about that: https://systemswe.love/archive/san-francisco-2016/you-are-not-expected-to-understand-this https://systemswe.love/archive/san-francisco-2016/you-are-no...