On Tuesday, 13 December 2016 19:20:04 UTC+11, Stannis Kozlov wrote:
>
> Thanks for reply, Dave
>
> I've made simple application and run it on Xeon and i5. In case of i5 I 
> see threads as expected, on Xeon CPU only one thread is working. May it 
> related with difference go versions? 
>

yes, this is why.

Before Go 1.5, Go defaulted to one CPU by 
default. https://golang.org/doc/go1.5

You should upgrade to Go 1.7.4 and prepare to upgrade to Go 1.8 early next 
year. You are using ancient and unsupported versions of 
Go. https://github.com/golang/go/wiki/Go-Release-Cycle#release-maintenance
 

>
> i5 output (go version 1.6):
> $ go run test_tr.go 
> Spinning thread
> Spinning thread
> Spinning thread
> Spinning thread
> Spinning thread
> Thread: 4
> Thread: 1
> Thread: 0
> Thread: 2
>
>
> Xeon output (go version 1.2.1):
> $ go run test_tr.go 
> Spinning thread
> Thread: 0
> ^Cexit status 2
>
>
>
>
> Code listing:
> package main
>
>
> import (
>  "fmt"
>  "math"
>  "sync"
> )
>
>
> func A1(z int, wg *sync.WaitGroup) {
>  fmt.Printf("Thread: %v\n",z)
>  var m, k float64 = 9.99999,9.999999
>  var i float64
>  for i = 0.0; i < 10000000000; i++ {
>  math.Sqrt(float64(m*i + k*i))
>  }
>  wg.Done()
> }
>
>
> func main() {
>  var wg sync.WaitGroup
>  for i := 0; i < 5; i++ {
>  wg.Add(1)
>  go A1(i, &wg)
>  fmt.Println("Spinning thread")
>  }
>  wg.Wait()
> }
>
>
> On Tuesday, December 13, 2016 at 12:56:50 AM UTC+3, Dave Cheney wrote:
>>
>> There are no settings to affect the scheduler save GOMAXPROCS. Check that 
>> none of your code or your dependencies are calling runtime.GOMAXPROCS.
>>
>> If that doesn't help, try profiling your application, the cpu or block 
>> profile might tell you where your program is hitting a point of contention. 
>>
>>

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