title: How is GOMAXPROCS determined on different platforms and inside containers?
body: <p>I am curious how does Go runtime determine <code>runtime.NumCPU()</code> (count of CPUs) on various platforms with wildly different characteristics like Linux, macOS and Windows?</p>
  
  <p>For example on Linux: I'm curious if it uses sysfs (/sys) to look at paths like <code>/sys/fs/cgroup/cpu/cpu.cfs_quota_us</code> to determine how many CPUs exist, or  procfs (<code>/proc/cpuinfo</code>) (this will be the wrong value in a container environment where container may have access to fewer CPUs than the host CPU count exposed in this file).</p>
  
  <p>Similarly on macOS, how is this value determined?</p>
  
  <p>I know some applications like JVM relies on cgroups memory info exposed on  /sys to set their internal heap size etc.</p>