Re:Comparison of the Go and Erlang concurrency models (2011)
by Rapzid on Thursday December 04, 2014 @05:36AM
(#8698658)
That's old information; every function call causes the check now.
Re:Comparison of the Go and Erlang concurrency models (2011)
by gtani on Thursday December 04, 2014 @01:23PM
(#8700751)
Correct from 1.2, except inlined calls, see here http://stackoverflow.com/questions/21102078/golang-methods-t...
and http://dave.cheney.net/2014/06/07/five-things-that-make-go-f...
Re:Comparison of the Go and Erlang concurrency models (2011)
by slimsag on Thursday December 04, 2014 @01:14PM
(#8700682)
Newer Go versions (1.2 I think?) use preemptive scheduling so you don't have to do anything special: that's my point entirely.
Goroutines by specification have the potential to run all at the same time, in the exact way that OS-level threads do.
In older _implementatoins_ of Go, goroutines were not preemptively scheduled, and exactly as you say you had to be careful.
The compiler only inserts yeilds at some call sites. It's not a total solution like real preemptive scheduling, so you still need to be careful.