by pjmlp · 4mo ago · 0 comments
Also how is the supposed Swift rewrite going on?
In any case a good concurrency library doesn't need more than C++14.
Naturally I haven't followed them that much, given how far away C++26 is from being usable for portable code.
Compilers are finally getting good enough with C++20 support for updating the default version.
Why would it be better? It’s pretty easy to set up threads in general.
If a bunch of tasks need to be schedule best not to have to reinvent the wheel on that if possible.
If there’s longer running tasks the benefits probably are less noticeable.
The main benefit is not having the cost of threads, f.ex. a default thread on Windows has something like 500k of stack iirc, scale that to 10000 concurrent requests and you're looking at 5gb of memory _just for stacks_, compared to a couroutine,etc that has perhaps a few kb's of usage (even if in deep stack-traces).
This is why we have stuff like io_uring these days, the bottleneck moved to the kernel calls (especially with Spectre style attacks) when concurrent costs in the applications went down.
In cooperative scheduling how is it possible to have two coroutines running concurrently?
Then just don't move them between threads and you're good with thread locals, no?