Updated to use sched_getaffinity() in get_avail_core_count()