You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GOMAXPROCS limits the number of OS threads used to actively run Goroutines. The goroutines in your example spend almost all their time sleeping (not running) . GOMAXPROCS will make more of a difference if your workers are performing a fixed amount of heavy computation instead.
I'd recommend asking these questions on the Gopher Slack forum, or golang-nuts. This issue tracker is intended for developing the Go toolchain and related projects.
As it was pointed out, there's no reason to expect the program to take 6s: all the goroutines just sleep for 3s an then the program ends. GOMAXPROCS' value makes no difference here. Closing, since this is not a bug in Go.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
My CPU nums:
Go Playground
What did you expect to see?
It should cost 6s.
What did you see instead?
It cost 3s.
The text was updated successfully, but these errors were encountered: