Am 08.10.2017 um 11:24 schrieb Suliman:

What happens with CPU registers when function call yield?

It's like context switching but without touching kernel? And it's save all CPU registers?

Yes, it basically stores all registers on the stack and then exchanges
the stack pointer for the one that was set when the fiber got
called/resumed. It's very similar to kernel context switches, although
kernel context switches, in addition to incurring a kernel mode
transition, have to do more work, depending on if it is a process switch
or just a thread switch.

Am I right understand that main different with Go, that Go automatically do routines switching, while in D programmer should call yield?

The main difference to goroutines is that those have dynamically growing
stacks, while D's fibers have a fixed stack size. This has advantages
and disadvantages, but on 64-bit systems, D's approach is generally fine.

Another difference is that goroutines can be moved between threads,
while vibe.d always keeps each fiber associated to a single thread, so
that no low level race conditions can happen and thread-local global
variables can be used. Go's approach on the other hand is more forgiving
when goroutines do heavy CPU work and vibe.d requires a bit more thought
(e.g. using runWorkerTask instead of runTask).