[Go] golang设置运行的cpu数
生活随笔
收集整理的這篇文章主要介紹了
[Go] golang设置运行的cpu数
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
package main
import("fmt""runtime"
)
func main() {cpuNum:=runtime.NumCPU()fmt.Println("cpuNum=",cpuNum)runtime.GOMAXPROCS(cpuNum)
}
轉載于:https://www.cnblogs.com/taoshihan/p/11295984.html
總結
以上是生活随笔為你收集整理的[Go] golang设置运行的cpu数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [Go] golang的MPG调度模型
- 下一篇: ubuntu apt-mirror 同步