sched_setaffinity
int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
if (sched_setaffinity(0, sizeof(cpumask), &cpumask) == -1) {