1TASKSET(1)                    Linux User's Manual                   TASKSET(1)
2
3
4

NAME

6       taskset - retrieve or set a processes's CPU affinity
7

SYNOPSIS

9       taskset [options] [mask | list ] [pid | command [arg]...]
10

DESCRIPTION

12       taskset  is  used  to  set  or  retrieve  the CPU affinity of a running
13       process given its PID or to launch a  new  COMMAND  with  a  given  CPU
14       affinity.   CPU affinity is a scheduler property that "bonds" a process
15       to a given set of CPUs on the system.  The Linux scheduler  will  honor
16       the  given CPU affinity and the process will not run on any other CPUs.
17       Note that the Linux scheduler also supports natural CPU  affinity:  the
18       scheduler attempts to keep processes on the same CPU as long as practi‐
19       cal for performance reasons.  Therefore, forcing a specific CPU  affin‐
20       ity is useful only in certain applications.
21
22       The CPU affinity is represented as a bitmask, with the lowest order bit
23       corresponding to the first logical CPU and the highest order bit corre‐
24       sponding  to  the  last logical CPU.  Not all CPUs may exist on a given
25       system but a mask may specify more CPUs than are present.  A  retrieved
26       mask  will  reflect only the bits that correspond to CPUs physically on
27       the system.  If an invalid mask is given (i.e., one that corresponds to
28       no  valid  CPUs on the current system) an error is returned.  The masks
29       are typically given in hexadecimal.  For example,
30
31       0x00000001
32              is processor #0
33
34       0x00000003
35              is processors #0 and #1
36
37       0xFFFFFFFF
38              is all processors (#0 through #31)
39
40       When taskset returns, it is guaranteed that the given program has  been
41       scheduled to a legal CPU.
42

OPTIONS

44       -p, --pid
45              operate on an existing PID and not launch a new task
46
47       -c, --cpu-list
48              specifiy  a  numerical  list of processors instead of a bitmask.
49              The list may contain multiple items,  separated  by  comma,  and
50              ranges.  For example, 0,5,7,9-11.
51
52       -h, --help
53              display usage information and exit
54
55       -V, --version
56              output version information and exit
57

USAGE

59       The  default  behavior  is  to  run a new command with a given affinity
60       mask:
61              taskset [mask] [command] [arguments]
62
63       You can also retrieve the CPU affinity of an existing task:
64              taskset -p [pid]
65
66       Or set it:
67              taskset -p [mask] [pid]
68

PERMISSIONS

70       A user must possess CAP_SYS_NICE  to  change  the  CPU  affinity  of  a
71       process.  Any user can retrieve the affinity mask.
72

AUTHOR

74       Written by Robert M. Love.
75

REPORTING BUGS

77       Report bugs to <rml@tech9.net>.
78
80       Copyright © 2004 Robert M. Love
81       This is free software; see the source for copying conditions.  There is
82       NO warranty; not even for MERCHANTABILITY or FITNESS FOR  A  PARTICULAR
83       PURPOSE.
84

SEE ALSO

86       chrt(1), nice(1), renice(1), sched_setaffinity(2), sched_getaffinity(2)
87
88       See  sched_setscheduler(2)  for  a  description of the Linux scheduling
89       scheme.
90
91
92
93schedutils                         Apr 2003                         TASKSET(1)
Impressum