2 ms·
This is interesting, but I don't really understand the differences with the existing coroutine libraries like libtask, libconcurrency or libcoro. Of course, it
by dfritz 11y ago
This is interesting, but I don't really understand the differences with
the existing coroutine libraries like libtask, libconcurrency or libcoro.
Of course, it uses the longjmp/setjmp trick, as suggested by Dmitry Vyukov.
http://www.1024cores.net/home/lock-free-algorithms/tricks/fibers http://www.1024cores.net/home/lock-free-algorithms/tricks/fi...
However, I'm not sure of the benefit of this approach, compared to
writing a few lines of stack switching assembly code per architecture.
Especially, how portable are the implementations of longjmp and setjmp
across the multitude of C libraries and operating systems?
But more importantly, it doesn't seem to solve the two main issues
of coroutines libraries written in C that were already solved in Go:
- How does the stack can grow or shrink? (specifying the stack size
in the worse case scenario doesn't scale well)
- How can a coroutine be moved to another operating system thread
and back? (useful when blocking or when parallelism is needed)