Thread affinity allows to run the thread on specified CPU or CPUs only.
The
pthread_setaffinity_np() function sets the affinity mask
set for
thread. At least one valid CPU must be set in the mask.
The
pthread_getaffinity_np() function gets the affinity mask of
thread into
set. Note that
set must be created and initialized using the
cpuset(3) functions.