Skip to content

sysctl name "hw.ncpu" (HW_NCPU) is deprecated in Mac OS X

According to the OS X man page for sysctl(https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/sysctlbyname.3.html), HW_NCPU used by the current implementation of getNumberOfProcessors() is deprecated.

Instead, Mac OS X provides the following 4 options:

  • hw.physicalcpu: The number of physical processors available in the current power management mode.
  • hw.physicalcpu_max: The maximum number of physical processors that could be available this boot.
  • hw.logicalcpu: The number of logical processors available in the current power management mode.
  • hw.logicalcpu_max: The maximum number of logical processors that could be available this boot.

I am not sure which one fits best to GHC runtime. Any idea? sysconf implementation of getNumberOfProcessors() seems to prefer _SC_NPROCESSORS_ONLN to _SC_NPROCESSORS_CONF when both are defined.

Trac metadata
Trac field Value
Version 7.6.3
Type Task
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC simonmar
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information