Refactored calculation of available CPUs.