OSDN Git Service

util-linux 2.38: 翻訳予約。
[linuxjm/jm.git] / manual / util-linux / original / man1 / taskset.1
1 '\" t
2 .\"     Title: taskset
3 .\"    Author: [see the "AUTHOR(S)" section]
4 .\" Generator: Asciidoctor 2.0.15
5 .\"      Date: 2022-02-17
6 .\"    Manual: User Commands
7 .\"    Source: util-linux 2.38
8 .\"  Language: English
9 .\"
10 .TH "TASKSET" "1" "2022-02-17" "util\-linux 2.38" "User Commands"
11 .ie \n(.g .ds Aq \(aq
12 .el       .ds Aq '
13 .ss \n[.ss] 0
14 .nh
15 .ad l
16 .de URL
17 \fI\\$2\fP <\\$1>\\$3
18 ..
19 .als MTO URL
20 .if \n[.g] \{\
21 .  mso www.tmac
22 .  am URL
23 .    ad l
24 .  .
25 .  am MTO
26 .    ad l
27 .  .
28 .  LINKSTYLE blue R < >
29 .\}
30 .SH "NAME"
31 taskset \- set or retrieve a process\(aqs CPU affinity
32 .SH "SYNOPSIS"
33 .sp
34 \fBtaskset\fP [options] \fImask command\fP [\fIargument\fP...]
35 .sp
36 \fBtaskset\fP [options] \fB\-p\fP [\fImask\fP] \fIpid\fP
37 .SH "DESCRIPTION"
38 .sp
39 The \fBtaskset\fP command is used to set or retrieve the CPU affinity of a running process given its \fIpid\fP, or to launch a new \fIcommand\fP 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.
40 .sp
41 The 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 \fB\-\-cpu\-list\fP option. For example,
42 .sp
43 \fB0x00000001\fP
44 .RS 4
45 is processor #0,
46 .RE
47 .sp
48 \fB0x00000003\fP
49 .RS 4
50 is processors #0 and #1,
51 .RE
52 .sp
53 \fB0xFFFFFFFF\fP
54 .RS 4
55 is processors #0 through #31,
56 .RE
57 .sp
58 \fB32\fP
59 .RS 4
60 is processors #1, #4, and #5,
61 .RE
62 .sp
63 \fB\-\-cpu\-list 0\-2,6\fP
64 .RS 4
65 is processors #0, #1, #2, and #6.
66 .RE
67 .sp
68 \fB\-\-cpu\-list 0\-10:2\fP
69 .RS 4
70 is 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.
71 .RE
72 .sp
73 When \fBtaskset\fP returns, it is guaranteed that the given program has been scheduled to a legal CPU.
74 .SH "OPTIONS"
75 .sp
76 \fB\-a\fP, \fB\-\-all\-tasks\fP
77 .RS 4
78 Set or retrieve the CPU affinity of all the tasks (threads) for a given PID.
79 .RE
80 .sp
81 \fB\-c\fP, \fB\-\-cpu\-list\fP
82 .RS 4
83 Interpret \fImask\fP as numerical list of processors instead of a bitmask. Numbers are separated by commas and may include ranges. For example: \fB0,5,8\-11\fP.
84 .RE
85 .sp
86 \fB\-p\fP, \fB\-\-pid\fP
87 .RS 4
88 Operate on an existing PID and do not launch a new task.
89 .RE
90 .sp
91 \fB\-h\fP, \fB\-\-help\fP
92 .RS 4
93 Display help text and exit.
94 .RE
95 .sp
96 \fB\-V\fP, \fB\-\-version\fP
97 .RS 4
98 Print version and exit.
99 .RE
100 .SH "USAGE"
101 .sp
102 The default behavior is to run a new command with a given affinity mask:
103 .RS 4
104 \fBtaskset\fP \fImask\fP \fIcommand\fP [\fIarguments\fP]
105 .RE
106 .sp
107 You can also retrieve the CPU affinity of an existing task:
108 .RS 4
109 \fBtaskset \-p\fP \fIpid\fP
110 .RE
111 .sp
112 Or set it:
113 .RS 4
114 \fBtaskset \-p\fP \fImask pid\fP
115 .RE
116 .SH "PERMISSIONS"
117 .sp
118 A user can change the CPU affinity of a process belonging to the same user. A user must possess \fBCAP_SYS_NICE\fP to change the CPU affinity of a process belonging to another user. A user can retrieve the affinity mask of any process.
119 .SH "AUTHORS"
120 .sp
121 Written by Robert M. Love.
122 .SH "COPYRIGHT"
123 .sp
124 Copyright (co 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.
125 .SH "SEE ALSO"
126 .sp
127 \fBchrt\fP(1),
128 \fBnice\fP(1),
129 \fBrenice\fP(1),
130 \fBsched_getaffinity\fP(2),
131 \fBsched_setaffinity\fP(2)
132 .sp
133 See \fBsched\fP(7) for a description of the Linux scheduling scheme.
134 .SH "REPORTING BUGS"
135 .sp
136 For bug reports, use the issue tracker at \c
137 .URL "https://github.com/util\-linux/util\-linux/issues" "" "."
138 .SH "AVAILABILITY"
139 .sp
140 The \fBtaskset\fP command is part of the util\-linux package which can be downloaded from \c
141 .URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."