TASKSET(1) TASKSET(1) taskset - taskset [] [...] taskset [] -p [] pid taskset , pid, . , <<'>> . Linux , - . , Linux : , . . , . , , . , , . , . ( ), . ( <<0x>> ) --cpu-list. : 0x00000001 0, 0x00000003 0 1, FFFFFFFF 0 31, 0x32 1, 4 5, --cpu-list 0-2,6 0, 1, 2 6. --cpu-list 0-10:2 0, 2, 4, 6, 8 10. <<:N>> . , 0-10:3 - 0,3,6,9. taskset , . -a, --all-tasks ( ) PID. -c, --cpu-list , . , . : 0,5,8-11. -p, --pid Operate on an existing PID and do not launch a new task. If PID is zero, then operate on the taskset process. -h, --help . -V, --version . : taskset [] , : taskset -p pid : taskset -p pid When a cpu-list is specified for an existing process, the -p and -c options must be grouped together: taskset -pc pid - --- : taskset --cpu-list - , . CAP_SYS_NICE, , . - . taskset returns 0 in its affinity-getting mode as long as the provided PID exists. taskset returns 0 in its affinity-setting mode as long as the underlying sched_setaffinity(2) system call does. The success of the command does not guarantee that the specified thread has actually migrated to the indicated CPU(s), but only that the thread will not migrate to a CPU outside the new affinity mask. For example, the affinity of the kernel thread kswapd can be set, but the thread may not immediately migrate and is not guaranteed to ever do so: $ ps ax -o comm,psr,pid | grep kswapd kswapd0 4 82 $ sudo taskset -p 1 82 pid 82's current affinity mask: 1 pid 82's new affinity mask: 1 $ echo $? 0 $ ps ax -o comm,psr,pid | grep kswapd kswapd0 4 82 $ taskset -p 82 pid 82's current affinity mask: 1 In contrast, when the user specifies an illegal affinity, taskset will print an error and return 1: $ ps ax -o comm,psr,pid | grep ksoftirqd/0 ksoftirqd/0 0 14 $ sudo taskset -p 1 14 pid 14's current affinity mask: 1 taskset: failed to set pid 14's affinity: Invalid argument $ echo $? 1 Print the current CPU affinity as a list. $ taskset -pc 0 pid 1355988's current affinity list: 0-47 Robert M. Love. (C) Robert M. Love, 2004. , . , . chrt(1), nice(1), renice(1), sched_getaffinity(2), sched_setaffinity(2) . sched(7), Linux. taskset util-linux, Linux . util-linux 2.42.3 2026-09-02 TASKSET(1)