News for hackers. Stuff that matters.
Re:Intro to images in Go – concurrency by topbanana on Friday November 01, 2013 @06:44AM (#6652884)
How do goroutines map to native OS threads? How do they get scheduled? It all seems a bit magical to me - which is great when things work as expected...
Re:Intro to images in Go – concurrency by lucian1900 on Friday November 01, 2013 @07:03AM (#6652933)
They get multiplexed across a few OS threads.

There is a scheduler which will leave goroutines that do a native (potentially blocking) call in their own thread.

Re:Intro to images in Go – concurrency by georgemcbay on Friday November 01, 2013 @04:53PM (#6656331)
The Go runtime has a built-in scheduler which historically would be called into action for possible preemption whenever an OS system call is made or could be invoked manually in Go code via runtime.Gosched(). Go 1.2 added a change allowing the scheduler to possibly be kicked off during any Go language function call which reduces the likelihood of being locked in a tight loop that never makes a system call.

There are obviously still cases where you can trap yourself into a deadlock by tight looping in code that makes no function calls at all, but it is pretty easy to detect this and adjust for it.

Re:Intro to images in Go – concurrency by brandonbloom on Friday November 01, 2013 @10:36AM (#6654012)
Is it really any more magical than how OS threads get mapped to CPU cores?