]> git.ipfire.org Git - thirdparty/util-linux.git/blame - schedutils/taskset.1.adoc
man pages: unify output of --help and --version
[thirdparty/util-linux.git] / schedutils / taskset.1.adoc
CommitLineData
295b3979 1//po4a: entry man manual
e2db4d94
MB
2////
3taskset(1) manpage
4Copyright (C) 2004 Robert Love
5
6This is free documentation; you can redistribute it and/or
7modify it under the terms of the GNU General Public License,
8version 2, as published by the Free Software Foundation.
9
10The GNU General Public License's references to "object code"
11and "executables" are to be interpreted as the output of any
12document formatting or typesetting system, including
13intermediate and printed output.
14
15This manual is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License along
21with this program; if not, write to the Free Software Foundation, Inc.,
2251 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23////
24= taskset(1)
25:doctype: manpage
f42ed819 26:man manual: User Commands
e2db4d94
MB
27:man source: util-linux {release-version}
28:page-layout: base
29:command: taskset
5a52459e
MB
30:colon: :
31:copyright: ©
e2db4d94
MB
32
33== NAME
34
35taskset - set or retrieve a process's CPU affinity
36
37== SYNOPSIS
38
4d297435 39*taskset* [options] _mask command_ [_argument_...]
e2db4d94 40
4d297435 41*taskset* [options] *-p* [_mask_] _pid_
e2db4d94
MB
42
43== DESCRIPTION
44
45The *taskset* command is used to set or retrieve the CPU affinity of a running process given its _pid_, or to launch a new _command_ with a given CPU affinity. CPU affinity is a scheduler property that "bonds" a process to a given set of CPUs on the system. The Linux scheduler will honor the given CPU affinity and the process will not run on any other CPUs. Note that the Linux scheduler also supports natural CPU affinity: the scheduler attempts to keep processes on the same CPU as long as practical for performance reasons. Therefore, forcing a specific CPU affinity is useful only in certain applications.
46
47The CPU affinity is represented as a bitmask, with the lowest order bit corresponding to the first logical CPU and the highest order bit corresponding to the last logical CPU. Not all CPUs may exist on a given system but a mask may specify more CPUs than are present. A retrieved mask will reflect only the bits that correspond to CPUs physically on the system. If an invalid mask is given (i.e., one that corresponds to no valid CPUs on the current system) an error is returned. The masks may be specified in hexadecimal (with or without a leading "0x"), or as a CPU list with the *--cpu-list* option. For example,
48
e2db4d94 49*0x00000001*::
5a52459e 50is processor #0,
e2db4d94
MB
51
52*0x00000003*::
5a52459e 53is processors #0 and #1,
e2db4d94
MB
54
55*0xFFFFFFFF*::
5a52459e 56is processors #0 through #31,
e2db4d94
MB
57
58*32*::
5a52459e 59is processors #1, #4, and #5,
e2db4d94
MB
60
61*--cpu-list 0-2,6*::
5a52459e 62is processors #0, #1, #2, and #6.
e2db4d94
MB
63
64*--cpu-list 0-10:2*::
5a52459e 65is processors #0, #2, #4, #6, #8 and #10. The suffix ":N" specifies stride in the range, for example 0-10:3 is interpreted as 0,3,6,9 list.
e2db4d94
MB
66
67When *taskset* returns, it is guaranteed that the given program has been scheduled to a legal CPU.
68
69== OPTIONS
70
71*-a*, *--all-tasks*::
5a52459e 72Set or retrieve the CPU affinity of all the tasks (threads) for a given PID.
e2db4d94
MB
73
74*-c*, *--cpu-list*::
5a52459e 75Interpret _mask_ as numerical list of processors instead of a bitmask. Numbers are separated by commas and may include ranges. For example: *0,5,8-11*.
e2db4d94
MB
76
77*-p*, *--pid*::
5a52459e 78Operate on an existing PID and do not launch a new task.
e2db4d94 79
2b2d3172 80include::man-common/help-version.adoc[]
e2db4d94
MB
81
82== USAGE
83
5a52459e
MB
84//TRANSLATORS: Keep {colon} untranslated.
85The default behavior is to run a new command with a given affinity mask{colon}::
86*taskset* _mask_ _command_ [_arguments_]
e2db4d94 87
5a52459e
MB
88//TRANSLATORS: Keep {colon} untranslated.
89You can also retrieve the CPU affinity of an existing task{colon}::
90*taskset -p* _pid_
e2db4d94 91
5a52459e
MB
92//TRANSLATORS: Keep {colon} untranslated.
93Or set it{colon}::
94*taskset -p* _mask pid_
e2db4d94
MB
95
96== PERMISSIONS
97
98A user can change the CPU affinity of a process belonging to the same user. A user must possess *CAP_SYS_NICE* to change the CPU affinity of a process belonging to another user. A user can retrieve the affinity mask of any process.
99
100== AUTHORS
101
102Written by Robert M. Love.
103
104== COPYRIGHT
105
5a52459e
MB
106//TRANSLATORS: Keep {copyright} untranslated.
107Copyright {copyright} 2004 Robert M. Love. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
e2db4d94 108
e2db4d94
MB
109== SEE ALSO
110
111*chrt*(1),
112*nice*(1),
113*renice*(1),
114*sched_getaffinity*(2),
115*sched_setaffinity*(2)
116
117See *sched*(7) for a description of the Linux scheduling scheme.
118
625e9c61 119include::man-common/bugreports.adoc[]
e2db4d94 120
625e9c61 121include::man-common/footer.adoc[]
e2db4d94
MB
122
123ifdef::translation[]
625e9c61 124include::man-common/translation.adoc[]
e2db4d94 125endif::[]