Re:A Repository with 44 Years of Unix Evolution
by waynecochran on Friday May 22, 2015 @12:49PM
(#9589494)
The most infamous comment in the history of source code from Unix V6. Now I can search an see at what stage this was committed.
[ Parent
| on HN ]
Re:A Repository with 44 Years of Unix Evolution
by barrkel on Friday May 22, 2015 @08:37PM
(#9591558)
I think this is only hard to understand if you are used to thinking at the level of the language rather than the CPU. I've done more evil things implementing language features in a compiler.
Re:A Repository with 44 Years of Unix Evolution
by userbinator on Friday May 22, 2015 @09:45PM
(#9591690)
From a brief glance at the surrounding code, this is part of the context switcher, which has to do stack switching. Also interesting to note that the whole function, swtch(), is only 71 lines. The entire kernel is less than 10kLOC.
I agree that understanding this type of code would be very difficult if you're used to the HLL notion of nesting function calls, because these don't work like regular functions; a call actually "returns" into a different one. You can't easily understand coroutines, threads, processes, and context switching without seeing that functions are really a structuring that HLLs impose, not the CPU itself.