3 ms·
Green threads can be switched between in a single time slice without ever doing a single syscall. This is trivially true: you can make a simple coroutine implem
by ninkendo 3y ago
Green threads can be switched between in a single time slice without ever doing a single syscall. This is trivially true: you can make a simple coroutine implementation in C that can switch back and forth between routines thousands of times in a single timeslice.
- otabdeveloper4 3y agoTechnically true, but nobody ever does this because it is a massive waste of CPU cycles. Both OS and "green" threads are meant to switch when doing i/o.
- gpderetta 3y agoUserspace IO is a thing though. Even with traditional kernel side IO, you might not want to attempt a syscall if the socket is known not to be ready. Also when implementing purely userspace synchronization primitives, being able to swap to a different context purely in userspace is nice.