]> git.ipfire.org Git - thirdparty/util-linux.git/blame - schedutils/taskset.1
docs: format, grammarize, and standardize the wall man page
[thirdparty/util-linux.git] / schedutils / taskset.1
CommitLineData
48d7b13a
KZ
1.\" taskset(1) manpage
2.\"
3.\" Copyright (C) 2004 Robert Love
4.\"
5.\" This is free documentation; you can redistribute it and/or
6.\" modify it under the terms of the GNU General Public License as
7.\" published by the Free Software Foundation; either version 2 of
8.\" the License.
9.\"
10.\" The GNU General Public License's references to "object code"
11.\" and "executables" are to be interpreted as the output of any
12.\" document formatting or typesetting system, including
13.\" intermediate and printed output.
14.\"
15.\" This manual is distributed in the hope that it will be useful,
16.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18.\" GNU General Public License for more details.
19.\"
7cebf0bb
SK
20.\" You should have received a copy of the GNU General Public License along
21.\" with this program; if not, write to the Free Software Foundation, Inc.,
22.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
48d7b13a
KZ
23.\"
24.\" 2002-05-11 Robert Love <rml@tech9.net>
25.\" Initial version
26.\"
232dc924 27.TH TASKSET 1 "April 2003" "util-linux" "User Commands"
48d7b13a 28.SH NAME
5ebbcdf9 29taskset \- retrieve or set a process's CPU affinity
48d7b13a
KZ
30.SH SYNOPSIS
31.B taskset
5ebbcdf9
LJ
32.RI [ options ]\ mask
33.IR command\ [ arg ]...
34.br
35.B taskset
36.RI [ options ]
37.B \-p
38.RI [ mask ]\ pid
48d7b13a
KZ
39.SH DESCRIPTION
40.PP
232dc924 41.B taskset
48d7b13a
KZ
42is used to set or retrieve the CPU affinity of a running process given its PID
43or to launch a new COMMAND with a given CPU affinity. CPU affinity is a
44scheduler property that "bonds" a process to a given set of CPUs on the system.
45The Linux scheduler will honor the given CPU affinity and the process will not
46run on any other CPUs. Note that the Linux scheduler also supports natural
47CPU affinity: the scheduler attempts to keep processes on the same CPU as long
48as practical for performance reasons. Therefore, forcing a specific CPU
49affinity is useful only in certain applications.
50.sp
51The CPU affinity is represented as a bitmask, with the lowest order bit
52corresponding to the first logical CPU and the highest order bit corresponding
53to the last logical CPU. Not all CPUs may exist on a given system but a mask
54may specify more CPUs than are present. A retrieved mask will reflect only the
55bits that correspond to CPUs physically on the system. If an invalid mask is
56given (i.e., one that corresponds to no valid CPUs on the current system) an
57error is returned. The masks are typically given in hexadecimal. For example,
58.TP
59.BR 0x00000001
60is processor #0
61.TP
62.BR 0x00000003
63is processors #0 and #1
64.TP
65.BR 0xFFFFFFFF
64109bba 66is all processors (#0 through #31).
48d7b13a
KZ
67.PP
68When
69.BR taskset
70returns, it is guaranteed that the given program has been scheduled to a legal
71CPU.
72.SH OPTIONS
73.TP
42708f12 74.BR \-a ,\ \-\-all-tasks
64109bba 75Set or retrieve the CPU affinity of all the tasks (threads) for a given PID.
42708f12 76.TP
5ebbcdf9 77.BR \-p ,\ \-\-pid
64109bba 78Operate on an existing PID and do not launch a new task.
48d7b13a 79.TP
5ebbcdf9 80.BR \-c ,\ \-\-cpu-list
64109bba
BS
81Specify a numerical list of processors instead of a bitmask. The numbers
82are separated by commas and may include ranges. For example:
48d7b13a
KZ
83.BR 0,5,7,9-11 .
84.TP
5ebbcdf9 85.BR \-h ,\ \-\-help
64109bba 86Display usage information and exit.
48d7b13a 87.TP
5ebbcdf9 88.BR \-V ,\ \-\-version
64109bba 89Display version information and exit.
48d7b13a
KZ
90.SH USAGE
91.TP
92The default behavior is to run a new command with a given affinity mask:
5ebbcdf9
LJ
93.B taskset
94.I mask
95.IR command\ [ arguments ]
48d7b13a
KZ
96.TP
97You can also retrieve the CPU affinity of an existing task:
5ebbcdf9
LJ
98.B taskset \-p
99.I pid
48d7b13a
KZ
100.TP
101Or set it:
5ebbcdf9
LJ
102.B taskset \-p
103.I mask pid
48d7b13a
KZ
104.SH PERMISSIONS
105A user must possess
5ebbcdf9 106.B CAP_SYS_NICE
48d7b13a
KZ
107to change the CPU affinity of a process. Any user can retrieve the affinity
108mask.
109.SH AUTHOR
110Written by Robert M. Love.
48d7b13a
KZ
111.SH COPYRIGHT
112Copyright \(co 2004 Robert M. Love
113.br
114This is free software; see the source for copying conditions. There is NO
115warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
116.SH "SEE ALSO"
117.BR chrt (1),
118.BR nice (1),
119.BR renice (1),
120.BR sched_setaffinity (2),
121.BR sched_getaffinity (2)
122.sp
123See
124.BR sched_setscheduler (2)
125for a description of the Linux scheduling scheme.
86d62711 126.SH AVAILABILITY
601d12fb
KZ
127The taskset command is part of the util-linux package and is available from
128ftp://ftp.kernel.org/pub/linux/utils/util-linux/.