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