2025-03-14 21:59:59 -06:00
|
|
|
# taskset
|
|
|
|
|
|
|
|
|
|
> Get or set a process' CPU affinity or start a new process with a defined CPU affinity.
|
|
|
|
|
> More information: <https://manned.org/taskset>.
|
|
|
|
|
|
|
|
|
|
- Get a running process' CPU affinity by PID:
|
|
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
`taskset {{[-p|--pid]}} {{[-c|--cpu-list]}} {{pid}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Set a running process' CPU affinity by PID:
|
|
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
`taskset {{[-p|--pid]}} {{[-c|--cpu-list]}} {{cpu_id}} {{pid}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Start a new process with affinity for a single CPU:
|
|
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
`taskset {{[-c|--cpu-list]}} {{cpu_id}} {{command}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Start a new process with affinity for multiple non-sequential CPUs:
|
|
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
`taskset {{[-c|--cpu-list]}} {{cpu_id_1}},{{cpu_id_2}},{{cpu_id_3}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Start a new process with affinity for CPUs 1 through 4:
|
|
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
`taskset {{[-c|--cpu-list]}} {{cpu_id_1}}-{{cpu_id_4}}`
|