The task is to find the number of logical CPUs the process can be running on at a given time. Here are the few examples.
Approach 1: Using the NumCPU function
NumCPU returns the number of logical CPUs usable by the current process.
func NumCPU() int
Approach 2: Using the GOMAXPROCS function
GOMAXPROCS sets the maximum number of CPUs that can be executing simultaneously and returns the previous setting.
func GOMAXPROCS(n int) int