Audit golang set to run

main Package 

Import ( 
	"FMT" 
	"Runtime" 
) 

// set the running audit golang 
more versions //1.8 automatically set 
FUNC main () { 
	// set the number of CPU cores running 
	// NumCPU returns a logical cpu local machine number 
	NUM: = runtime.NumCPU () 
	
	fmt.Println (NUM) 

	// set the maximum number of CPU can execute concurrently GOMAXPROCS 
	runtime.GOMAXPROCS (NUM) 
}

  

Guess you like

Origin www.cnblogs.com/zhangxiaoj/p/11258738.html