Returns the number of CPUs available to this thread.
fn cpu_count() -> Result<usize, Errno>
Use cpus to get the number of CPUs available to other threads.
sched_getaffinity(2)