How are goroutines scheduled within the Go runtime? Is it some cooperative scheduling like reduction-count scheduling in Erlang or is it based on time-slices and a timer (more like the traditional OS way)?Thanks,Daniel--
Improving this is high on the to-do list, and there is no reason why Go can't have preemptive scheduling.
--
--
Personally, I'm quite indifferent, and totally agree coop has its advantages. I think I've only been bothered by the current scheduler once -- a goroutine that didn't yield depended on another goroutine doing something -- but that was solved by simply using more than one process (plus it was pretty shoddy design on my part.)Maybe Dmitry (cc) has an opinion on Erlang-style reduction counts?
On Mon, Oct 29, 2012 at 3:03 PM, Patrick Mylund Nielsen <pat...@patrickmylund.com> wrote:Personally, I'm quite indifferent, and totally agree coop has its advantages. I think I've only been bothered by the current scheduler once -- a goroutine that didn't yield depended on another goroutine doing something -- but that was solved by simply using more than one process (plus it was pretty shoddy design on my part.)Maybe Dmitry (cc) has an opinion on Erlang-style reduction counts?I don't really know, but I suspect that Erlang had chosen reduction counts because of the stricter real-time requirements. And by that time single-core machines were more ubiquitous.I think to typical Go workloads on modern multi-core machines asynchronous preemption makes more sense (no overheads on common path).