Setting a process affinity allows for restricting the process to only use certain
cores in the machine. The cores are indexed by the operating system as 1 to ncores()
.
Calling setaffinity()
with no arguments resets the process to use any of the
available cores.
Note that setaffinity is different from setting r_limit values in the sense that
it is not a one-way process. An unprivileged user can change the process affinity
to any value. In order to 'lock' an affinity value, one would have to manipulate
Linux capability value for CAP_SYS_NICE.