It was my own fault:-(
I'm now almost maxing out the CPUs. Basically, I'd created some goroutines 
to do work but forgot to call 'go' at one stage of my pipeline so that 
blocked.

On Monday, February 27, 2017 at 7:20:48 PM UTC, Guillermo Estrada wrote:
>
> Yeah it probably is, even while creating a lot of Goroutines, if your code 
> spends too much time allocating memory and such, it won't be reflected in 
> the CPU usage.
> Anyway, for what it's worth you can always check all that at runtime if 
> you run into doubts again.
>
> https://golang.org/pkg/runtime/
>
> runtime.NumCPU()
> will report the logical CPU count and
> runtime.GOMAXPROCS(n int) int
> will set the MAX number of threads at runtime.
>
>
> On Monday, February 27, 2017 at 1:13:33 PM UTC-6, Mark wrote:
>>
>> Yes, in VirtualBox on this machine I have Processors set to 4 and the 
>> Execution Cap set to 100% (i.e., no limit). I've also tried it on a real 
>> Windows 7 machine which has 2 cores & that only uses 1 thread and I've 
>> tried it on another VirtualBox, again it only uses 1 thread.
>>
>> I've now tried the du4 example from "The Go Programming Language" book. 
>> My code is based on this example, but whereas du4 briefly peaks at 70-80% 
>> CPU my own code never exceeds 50%. So I guess the problem is with my code:-(
>>
>> On Monday, February 27, 2017 at 6:59:11 PM UTC, Guillermo Estrada wrote:
>>>
>>> Are you sure your virtual machine has 4 cores assigned? You might have 4 
>>> cores, but when you create the VM you can assign any number of cores to it 
>>> (1 being default IIRC).
>>>
>>> On Monday, February 27, 2017 at 12:39:31 PM UTC-6, Mark wrote:
>>>>
>>>> I just tried this on an old Windows 7-32bit machine which reports 
>>>> GOMAXPROCS of 2 but only one is ever used.
>>>>
>>>> On Monday, February 27, 2017 at 5:32:17 PM UTC, Mark wrote:
>>>>>
>>>>> I have a Go app that only uses 1 thread when GOMAXPROCS is 4 on 
>>>>> Windows 7-64bit inside VirtualBox even though I can have up to 20 
>>>>> goroutines. Is this a known problem? And is there a solution that can 
>>>>> force 
>>>>> Go to use all 4 CPUs? (The underlying hardware is a 64-bit i7.)
>>>>> Thanks.
>>>>>
>>>>

-- 
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