Skip to main content

process_affinity_cpus

Function process_affinity_cpus 

Source
pub fn process_affinity_cpus() -> Vec<usize>
Expand description

The logical CPUs this process may actually run on, ascending.

This is the affinity mask, not the machine: a pool sized to the machine inside a taskset- or cpuset-confined container oversubscribes the slice it was given by exactly the factor it was confined by, and every worker then time-slices against every other. Linux reads sched_getaffinity; everywhere else (macOS included, which has no equivalent) this is 0..available_parallelism(), i.e. today’s answer.