On Sunday, 14 June 2015 at 12:35:44 UTC, Robert M. Münch wrote:
Hi, just to x-check if I have the correct understanding:
fibers = look parallel, are sequential => use 1 CPU core
threads = look parallel, are parallel => use several CPU cores
Is that right?
Fibers/co-routines run on a thread and is conceptually the same
as a functor/object-with-method that can suspend itself and hold
onto the state until it is restarted. Like yield in Python
generators.
Fibers have their own stack, but that is an implementation
detail. It is possible to do the same thing with
object-method-calls if you have stackless code-generation (D does
not support stackless runtimes, but you'll find this in other
languages).