Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> In Go 1.5, the order in which goroutines are scheduled has been changed. The properties of the scheduler were never defined by the language, but programs that depended on the scheduling order may be broken by this change.

Are there any more details about the change to goroutine scheduling? Is this more than the just change to the GOMAXPROCS' default value?



> Are there any more details about the change to goroutine scheduling?

That would defeat the repetition about scheduling order being undefined wouldn't it?

But according to issue 11372 the answer is that up to 1.4 the scheduler would run goroutines in definition order so if you started goroutines 1,2,3,4,5 it tended to run 1,2,3,4,5. In 1.5 it's biased to favour the last-started routine so it'd run 5,1,2,3,4. Again scheduling order is undefined so the order may change again in 1.6, explicitly relying on it would be an idiotic idea.

They have also introduced limited scheduling randomisation in race detection mode[0] which they intend to randomise further in 1.6 to make scheduling-order dependencies easier to suss out and fix.

> Is this more than the just change to the GOMAXPROCS' default value?

The change to GOMAXPROCS wouldn't have changed the order in which the scheduler picks routines, since it could already be set to a non-default value previously.

[0] https://github.com/golang/go/commit/202807789946a8f3f415bf00...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: