Patch by Julian Taylor.
.. function:: cpu_count()
- Return the number of CPUs in the system. May raise
- :exc:`NotImplementedError`.
+ Return the number of CPUs in the system.
+
+ 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))``
+
+ May raise :exc:`NotImplementedError`.
.. seealso::
:func:`os.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))``
+
+
.. versionadded:: 3.4
Christian Tanzer
Steven Taschuk
Amy Taylor
+Julian Taylor
Monty Taylor
Anatoly Techtonik
Gustavo Temple
pid: pid_t
/
-Return the affinity of the process identified by pid.
+Return the affinity of the process identified by pid (or the current process if zero).
The affinity is returned as a set of CPU identifiers.
[clinic start generated code]*/
/*[clinic input]
os.cpu_count
-Return the number of CPUs in the system; return None if indeterminable.
+Return the number of CPUs in the system; return None if indeterminable. 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))``
[clinic start generated code]*/
static PyObject *