[3.11] [3.12] gh-109649: Enhance os.cpu_count() documentation (GH-110169) by miss-islington · Pull Request #110226 · python/cpython
.. function:: sched_getaffinity(pid, /)
Return the set of CPUs the process with PID *pid* (or the current process if zero) is restricted to. Return the set of CPUs the process with PID *pid* is restricted to.
If *pid* is zero, return the set of CPUs the calling thread of the current process is restricted to.
.. _os-path:
.. function:: cpu_count()
Return the number of CPUs in the system. Returns ``None`` if undetermined.
This number is not equivalent to the number of CPUs the current process can use. The number of usable CPUs can be obtained with ``len(os.sched_getaffinity(0))`` Return the number of logical CPUs in the system. Returns ``None`` if undetermined.
This number is not equivalent to the number of logical CPUs the current process can use. ``len(os.sched_getaffinity(0))`` gets the number of logical CPUs the calling thread of the current process is restricted to
.. versionadded:: 3.4