Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

A.15. taskset

The taskset tool is provided by the util-linux package. It allows administrators to retrieve and set the processor affinity of a running process, or launch a process with a specified processor affinity.

Important

taskset does not guarantee local memory allocation. If you require the additional performance benefits of local memory allocation, Red Hat recommends using numactl instead of taskset.
To set the CPU affinity of a running process, run the following command:
# taskset -pc processors pid
Replace processors with a comma delimited list of processors or ranges of processors (for example, 1,3,5-7. Replace pid with the process identifier of the process that you want to reconfigure.
To launch a process with a specified affinity, run the following command:
# taskset -c processors -- application
Replace processors with a comma delimited list of processors or ranges of processors. Replace application with the command, options and arguments of the application you want to run.
For more information about taskset, see the man page:
$ man taskset