You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On GNU/Linux it might be slightly more efficient to use the sched_getaffinity system
call to get the number of virtual processors. It would be one system call instead of
three or more, and it would not touch the filesystem. The function, getproccount in
runtime/thread_linux.c, is called at the start of every program.
But note that if the system is actually using CPU affinity, this will cause
runtime.NumCPU to return the number of virtual processors that the process is permitted
to run on, rather than the number of virtual processors on the system.