4 ms·
What you describe is the actual procedure of switching threads. What cheatercheater describes is the mechanics of initiating this switch. You have "checkpoints"
by _quasimodo 14y ago
What you describe is the actual procedure of switching threads. What cheatercheater describes is the mechanics of initiating this switch. You have "checkpoints" in the thread, where the thread finds out if it is to be descheduled and performs a conditional branch to the code that does what you described.
Apparently in GHC code, there is no conditional branch instruction, an unconditional jump is generated on the fly, probably to avoid branch mispredictions.