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

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.




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

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

Search: