Documentation mentions that, Sleep pauses the current goroutine(G
) for at least the duration d.
G
cannot be in run-queue(grey circles below) for duration d
.
https://morsmachine.dk/go-scheduler
P
is context. M
is kernel thread
Assume there are 8 kernel threads(because 8 core CPU - runtime.NumCPU()
)
Go runtime maintaining runtime.GOMAXPROCS(runtime.NumCPU())
number of contexts.
Using GO version 1.12
1) In which queue does Goroutine(G
) wait for duration d
? I see run-queue(above in grey)
2) In that duration d
, Does that corresponding context(P
) schedule another Goroutine from its run-queue on that same kernel thread(M
)?
3) Can GO program schedule a Goroutine on specific context(P
) run-queue?