4 ms·
With cooperative multitasking (coroutines) you can get by with saving less CPU state. I do this for my C coroutines package [1] for x86 and x86-64 by only savi
by spc476 7y ago
With cooperative multitasking (coroutines) you can get by with saving less CPU state. I do this for my C coroutines package [1] for x86 and x86-64 by only saving the registers required by the calling convention.
[1] https://github.com/spc476/C-Coroutines https://github.com/spc476/C-Coroutines
- headlessclayton 7y agoMarl does exactly this. The scheduler guarantees that once a task is started on a particular thread, it will only resume on that same thread. This allows us to save a bare minimum of registers and state. Some more info here: https://github.com/google/marl/blob/cbef55d588bc28661bedb8220531758f7a44fc0e/src/osfiber_asm.h#L15-L23 https://github.com/google/marl/blob/cbef55d588bc28661bedb822...