Previous | Next --- Slide 6 of 43
Back to Lecture Thumbnails

When it is time to perform context switches, does the OS kernel replace all the threads in all the execution contexts? Or does it perform context switches at different times for different execution contexts? I'm guessing it is the latter approach, but I still want to know what the correct answer is.


@fleventyfive Usually the latter happens, and the OS swaps threads into execution contexts by round-robin (or some other heuristic).

The main reason is that the "interrupts" are pretty costly, and we want it to be as light-weight as possible. Also, swapping one logical thread at a time allows better granulairty.