Steve,
I checked with strace and top -p (press H to see threads).
It seems that Go can create few more threads than cores are given by taskset.
For example, on an 8 core ARM machine in the cloud, I got these
results on a program launching 100 goroutines utilizing a lot of CPU
each.
$ strace --follow-forks -o /tmp/m2.log taskset --cpu-list 0 ./main
1
^C
$ strace --follow-forks -o /tmp/m2.log taskset --cpu-list 0-7 ./main
8
^C
$ grep -c clone /tmp/m.log
3
$ grep -c clone /tmp/m2.log
13
So for 8 cores it launched 13 threads, for 1 core - 3 threads.
You can try running your tool under "strace --follow-forks" and count
how many "clone" calls there are in the log.
Try to set just 1 core in taskset (taskset --cpu-list 0) and see if it
works and how many threads it launches. If it works, try to increase
the number of cores in taskset until it breaks.
Here is my program:
package main
import (
"sync/atomic"
"fmt"
"runtime"
"time"
)
func main() {
fmt.Println(runtime.NumCPU())
var b atomic.Int64
for i := 0; i < 100; i++ {
go func() {
for {
b.Add(1)
time.Sleep(1000)
}
}()
}
time.Sleep(1000*time.Second)
Best regards,
Boris Nagaev