Fantastic! In my main program I had the main in an infinite for. That was 
burning the only core of my vm.
I've changed that to select and now it's working fine.

Thank you Konstantin, for your answer, too.

El miércoles, 8 de marzo de 2017, 11:50:09 (UTC-3), Chris Hines escribió:
>
> The infinite loops in each function will busy loop and consume a core 
> without allowing the runtime scheduler a chance to run other goroutines on 
> that core. If your virtual machine doesn't have enough cores then some 
> goroutines may starve.
>
> Change the loops to select {} to block infinitely without busy looping and 
> see if that behaves as expected.
>
> On Wednesday, March 8, 2017 at 9:20:39 AM UTC-5, Rodrigo Pardo wrote:
>>
>> I've made this test program
>>
>>
>> package main
>>
>> import "fmt"
>>
>> func func1() {
>>     fmt.Println("running func1")
>>     for {
>>
>>     }
>> }
>>
>> func func2() {
>>     fmt.Println("running func1")
>>     for {
>>
>>     }
>> }
>>
>> func func3() {
>>     fmt.Println("running func1")
>>     for {
>>
>>     }
>> }
>>
>> func main() {
>>
>>     go func1()
>>     fmt.Println("run func1")
>>     go func2()
>>     fmt.Println("run func2")
>>     go func3()
>>     fmt.Println("run func3")
>>     for {
>>
>>     }
>>
>> }
>>
>> On windows I get 
>> go run test.go
>>
>> run func1
>> running func1
>> run func2
>> running func1
>> run func3
>> running func1
>>
>> On Linux, cross compiled (go build -v) I get
>> ./test
>>
>> run func1
>> run func2
>> run func3
>>
>> Now I've installed go to my linux and I'm compiling directly from there 
>> (gopath set to shared folder)
>> go run test.go 
>>
>> run func1
>> run func2
>> run func3
>>
>>
>> El miércoles, 8 de marzo de 2017, 10:48:26 (UTC-3), Ayan George escribió:
>>>
>>>
>>>
>>> On 03/08/2017 08:30 AM, asc...@gmail.com wrote: 
>>>
>>> > In the main function I call various go routines, I've set println 
>>> after 
>>> > each call, so I know they are being executed. But I don't get the 
>>> > printlns I've set inside of some of those routines, for the same 
>>> purpose. 
>>> > 
>>>
>>> So you are seeing some Println()s but not others or are you not seeing 
>>> any Println()s at all? 
>>>
>>> -ayan 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to