2020-03-11 00:27:49 +00:00
|
|
|
# taskset
|
2019-04-25 17:58:40 +01:00
|
|
|
|
|
|
|
> Get or set a process' CPU affinity or start a new process with a defined CPU affinity.
|
2022-03-21 17:07:48 +00:00
|
|
|
> More information: <https://manned.org/taskset>.
|
2019-04-25 17:58:40 +01:00
|
|
|
|
|
|
|
- Get a running process' CPU affinity by PID:
|
|
|
|
|
|
|
|
`taskset --pid --cpu-list {{pid}}`
|
|
|
|
|
|
|
|
- Set a running process' CPU affinity by PID:
|
|
|
|
|
|
|
|
`taskset --pid --cpu-list {{cpu_id}} {{pid}}`
|
|
|
|
|
|
|
|
- Start a new process with affinity for a single CPU:
|
|
|
|
|
|
|
|
`taskset --cpu-list {{cpu_id}} {{command}}`
|
|
|
|
|
|
|
|
- Start a new process with affinity for multiple non-sequential CPUs:
|
|
|
|
|
2021-12-16 02:45:58 +00:00
|
|
|
`taskset --cpu-list {{cpu_id_1}},{{cpu_id_2}},{{cpu_id_3}}`
|
2019-04-25 17:58:40 +01:00
|
|
|
|
|
|
|
- Start a new process with affinity for CPUs 1 through 4:
|
|
|
|
|
2021-12-16 02:45:58 +00:00
|
|
|
`taskset --cpu-list {{cpu_id_1}}-{{cpu_id_4}}`
|