Re:Libaco: A fast and lightweight C asymmetric coroutine lib...
by srean on Saturday July 14, 2018 @05:44AM
(#17529611)
Its possible now, with current hardware and address space size. With coroutines you could to that 15 years ago on 32 bit machines.
> so they scale the same way
The difference is the within user space context switch vs kernel space/user space context switch.
Re:Libaco: A fast and lightweight C asymmetric coroutine lib...
by AHTERIX5000 on Saturday July 14, 2018 @06:10AM
(#17529677)
Just microbenchmarking thread creation is different case, the issue is usually letting OS scheduler to decide what to run and when while coroutines give you explicit access. Coroutines are quite a different thing than OS-level schedulable entities.
Re:Libaco: A fast and lightweight C asymmetric coroutine lib...
by amelius on Saturday July 14, 2018 @05:42AM
(#17529600)
> Coroutines are basically just user-space threads
Except you don't have preemption, so you may get e.g. latency issues.
Re:Libaco: A fast and lightweight C asymmetric coroutine lib...
by coldtea on Saturday July 14, 2018 @06:04AM
(#17529658)
Whereas with threads you don't get latency issues?
Re:Libaco: A fast and lightweight C asymmetric coroutine lib...
by amelius on Saturday July 14, 2018 @06:16AM
(#17529692)
With threads, latency problems are spread out more evenly by design.
Re:Libaco: A fast and lightweight C asymmetric coroutine lib...
by blattimwind on Saturday July 14, 2018 @08:14AM
(#17530008)
Ah well, experience tells us that scheduling latency under load with Linux is a difficult topic.
Coroutines are basically just user-space threads, so they scale the same way. You need to keep around a stack for each and swap it in and out of cache.
See for example: https://stackoverflow.com/questions/1900165/how-long-does-it...