1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/linux/taskset.md
dathide b205ef3b38
Fix syntax (#7543)
Fix the syntax for running on non-sequential CPUs, which is done with commas. Also fix the syntax for running on sequential CPUs, which uses a "-".
2021-12-15 19:45:58 -07:00

23 lines
616 B
Markdown

# taskset
> Get or set a process' CPU affinity or start a new process with a defined CPU affinity.
- 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:
`taskset --cpu-list {{cpu_id_1}},{{cpu_id_2}},{{cpu_id_3}}`
- Start a new process with affinity for CPUs 1 through 4:
`taskset --cpu-list {{cpu_id_1}}-{{cpu_id_4}}`