Hacker News new | past | comments | ask | show | jobs | submit login

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.

  2230  /*
  2231	 * If the new process paused because it was
  2232	 * swapped out, set the stack level to the last call
  3333	 * to savu(u_ssav).  This means that the return
  2235	 * actually returns from the last routine which did
  2236	 * the savu.
  2237	 *
  2238	 * You are not expected to understand this.
  2239	 */
  2240	if(rp->p_flag&SSWAP) {
  2241		rp->p_flag =& ~SSWAP;
  2242		aretu(u.u_ssav);
  2243	}



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.


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.


well, it's "not expected to" (we won't ask you about at the exam) rather than "expected not to" (this is too difficult for you feeble minds) :)


I think that precedes any Unix revision control finer than ‘Sixth Edition’. (PWB, which included the SCCS port, was built on V6.)




Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: