Re:Re: 100k Threads? (2002)
by ninkendo on Saturday September 23, 2023 @08:18AM
(#37622619)
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.
[ Parent
| on HN ]
Re:Re: 100k Threads? (2002)
by otabdeveloper4 on Saturday September 23, 2023 @10:13AM
(#37623390)
Technically 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.
Userspace 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.