以下测试,使用的Go版本是1.8.3 不设置 如果没有调用runtime.GOMAXPROCS 去设置CPU,Golang默认使用所有的cpu核. 测试机器CPU有4个核,测试代码开启4个goroutine,从测试结果看4个核心全部跑满. 测试代码如下: package main func main() { go task() go task() go task() go task() select{} } func task(){ for { } } 设置CPU使用 func GOMAXPRO
判断依据: 1.具有相同core id的cpu是同一个core的超线程. 2.具有相同physical id的cpu是同一颗cpu封装的线程或者cores. 英文版: 1.Physical id and core id are not necessarily consecutive but they are unique. Any cpu with the same core id are hyperthreads in the same core. 2.Any cpu with the sam