]> git.ipfire.org Git - thirdparty/util-linux.git/blame - schedutils/chrt.1.adoc
add more concrete examples of how to use chrt(1)
[thirdparty/util-linux.git] / schedutils / chrt.1.adoc
CommitLineData
295b3979 1//po4a: entry man manual
e2db4d94
MB
2////
3chrt(1) manpage
4
5Copyright (C) 2004 Robert Love
6Copyright (C) 2015 Karel Zak <kzak@redhat.com>
7
8This is free documentation; you can redistribute it and/or
9modify it under the terms of the GNU General Public License,
10version 2, as published by the Free Software Foundation.
11
12The GNU General Public License's references to "object code"
13and "executables" are to be interpreted as the output of any
14document formatting or typesetting system, including
15intermediate and printed output.
16
17This manual is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License along
23with this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25////
26= chrt(1)
27:doctype: manpage
f42ed819 28:man manual: User Commands
e2db4d94
MB
29:man source: util-linux {release-version}
30:page-layout: base
31:command: chrt
5a52459e 32:colon: :
e2db4d94
MB
33
34== NAME
35
36chrt - manipulate the real-time attributes of a process
37
38== SYNOPSIS
39
4d297435 40*chrt* [options] _priority command argument_ ...
e2db4d94 41
4d297435 42*chrt* [options] *-p* [_priority_] _PID_
e2db4d94
MB
43
44== DESCRIPTION
45
46*chrt* sets or retrieves the real-time scheduling attributes of an existing _PID_, or runs _command_ with the given attributes.
47
48== POLICIES
49
50*-o*, *--other*::
5a52459e 51Set scheduling policy to *SCHED_OTHER* (time-sharing scheduling). This is the default Linux scheduling policy.
e2db4d94
MB
52
53*-f*, *--fifo*::
5a52459e 54Set scheduling policy to *SCHED_FIFO* (first in-first out).
e2db4d94
MB
55
56*-r*, *--rr*::
5a52459e 57Set scheduling policy to *SCHED_RR* (round-robin scheduling). When no policy is defined, the *SCHED_RR* is used as the default.
e2db4d94
MB
58
59*-b*, *--batch*::
5a52459e 60Set scheduling policy to *SCHED_BATCH* (scheduling batch processes). Linux-specific, supported since 2.6.16. The priority argument has to be set to zero.
e2db4d94
MB
61
62*-i*, *--idle*::
5a52459e 63Set scheduling policy to *SCHED_IDLE* (scheduling very low priority jobs). Linux-specific, supported since 2.6.23. The priority argument has to be set to zero.
e2db4d94
MB
64
65*-d*, *--deadline*::
5a52459e 66Set scheduling policy to *SCHED_DEADLINE* (sporadic task model deadline scheduling). Linux-specific, supported since 3.14. The priority argument has to be set to zero. See also *--sched-runtime*, *--sched-deadline* and *--sched-period*. The relation between the options required by the kernel is runtime <= deadline <= period. *chrt* copies _period_ to _deadline_ if *--sched-deadline* is not specified and _deadline_ to _runtime_ if *--sched-runtime* is not specified. It means that at least *--sched-period* has to be specified. See *sched*(7) for more details.
e2db4d94 67
e2db4d94
MB
68== SCHEDULING OPTIONS
69
70*-T*, *--sched-runtime* _nanoseconds_::
5a52459e 71Specifies runtime parameter for *SCHED_DEADLINE* policy (Linux-specific).
e2db4d94
MB
72
73*-P*, *--sched-period* _nanoseconds_::
5a52459e 74Specifies period parameter for *SCHED_DEADLINE* policy (Linux-specific).
e2db4d94
MB
75
76*-D*, *--sched-deadline* _nanoseconds_::
5a52459e 77Specifies deadline parameter for *SCHED_DEADLINE* policy (Linux-specific).
e2db4d94
MB
78
79*-R*, *--reset-on-fork*::
5a52459e 80Use *SCHED_RESET_ON_FORK* or *SCHED_FLAG_RESET_ON_FORK* flag. Linux-specific, supported since 2.6.31.
e2db4d94
MB
81
82Each thread has a _reset-on-fork_ scheduling flag. When this flag is set, children created by *fork*(2) do not inherit privileged scheduling policies. After the _reset-on-fork_ flag has been enabled, it can be reset only if the thread has the *CAP_SYS_NICE* capability. This flag is disabled in child processes created by *fork*(2).
83
84More precisely, if the _reset-on-fork_ flag is set, the following rules apply for subsequently created children:
85
5a52459e 86* If the calling thread has a scheduling policy of *SCHED_FIFO* or *SCHED_RR*, the policy is reset to *SCHED_OTHER* in child processes.
e2db4d94 87
5a52459e 88* If the calling process has a negative nice value, the nice value is reset to zero in child processes.
e2db4d94
MB
89
90== OPTIONS
91
92*-a*, *--all-tasks*::
5a52459e 93Set or retrieve the scheduling attributes of all the tasks (threads) for a given PID.
e2db4d94
MB
94
95*-m*, *--max*::
5a52459e 96Show minimum and maximum valid priorities, then exit.
e2db4d94
MB
97
98*-p*, *--pid*::
5a52459e 99Operate on an existing PID and do not launch a new task.
e2db4d94
MB
100
101*-v*, *--verbose*::
5a52459e 102Show status information.
e2db4d94 103
2b2d3172 104include::man-common/help-version.adoc[]
e2db4d94 105
84b6b6ac 106== EXAMPLES
e2db4d94 107
5a52459e
MB
108//TRANSLATORS: Keep {colon} untranslated
109The default behavior is to run a new command{colon}::
e2db4d94
MB
110
111*chrt* _priority_ _command_ [_arguments_]
112
5a52459e
MB
113//TRANSLATORS: Keep {colon} untranslated
114You can also retrieve the real-time attributes of an existing task{colon}::
e2db4d94
MB
115
116*chrt -p* _PID_
117
5a52459e
MB
118//TRANSLATORS: Keep {colon} untranslated
119Or set them{colon}::
e2db4d94
MB
120
121*chrt -r -p* _priority PID_
122
84b6b6ac
AB
123This, for example, sets real-time scheduling to priority _30_ for the
124process _PID_ with the *SCHED_RR* (round-robin) class:
125
126*chrt -r -p 30 _PID_*
127
128Reset priorities to default for a process:
129
130*chrt -o -p 0 _PID_*
131
132See *sched*(7) for a detailed discussion of the different scheduler
133classes and how they interact.
134
e2db4d94
MB
135== PERMISSIONS
136
137A user must possess *CAP_SYS_NICE* to change the scheduling attributes of a process. Any user can retrieve the scheduling information.
138
139== NOTES
140
141Only *SCHED_FIFO*, *SCHED_OTHER* and *SCHED_RR* are part of POSIX 1003.1b Process Scheduling. The other scheduling attributes may be ignored on some systems.
142
143Linux' default scheduling policy is *SCHED_OTHER*.
144
145== AUTHORS
146
5a52459e 147mailto:rml@tech9.net[Robert Love],
4d297435 148mailto:kzak@redhat.com[Karel Zak]
e2db4d94 149
e2db4d94
MB
150== SEE ALSO
151
152*nice*(1),
153*renice*(1),
154*taskset*(1),
155*sched*(7)
156
157See *sched_setscheduler*(2) for a description of the Linux scheduling scheme.
158
625e9c61 159include::man-common/bugreports.adoc[]
e2db4d94 160
625e9c61 161include::man-common/footer.adoc[]
e2db4d94
MB
162
163ifdef::translation[]
625e9c61 164include::man-common/translation.adoc[]
e2db4d94 165endif::[]