How does Go decide to switch context between goroutines?

I am curious how the Go language paints goroutines. Does it turn on only during channel and I / O requests or does it have a periodic coprocessor switching cycle?

+6
source share
1 answer

Go does not yet have a proactive scheduler, but one is scheduled for 1.2 . Thus, no, Go will not switch context during calculations only for the CPU, only during I / O (reading from memory is also considered I / O if it is not already in the register). You can read about this in Issue 543 — Proactive Planning .

+8
source

Source: https://habr.com/ru/post/952866/


All Articles