package main import ( "fmt" "runtime" ) func main() { n := runtime.NumCPU() fmt.Print(n) runtime.GOMAXPROCS(n - 1) //设置cpu运行的数目 }