summaryrefslogtreecommitdiffstats
path: root/schedutils/chrt.1.adoc
blob: fdee4637acf06c6f6fb7ea831bb9f3ad5e65a09e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//po4a: entry man manual
////
chrt(1) manpage

Copyright (C) 2004 Robert Love
Copyright (C) 2015 Karel Zak <kzak@redhat.com>

This is free documentation; you can redistribute it and/or
modify it under the terms of the GNU General Public License,
version 2, as published by the Free Software Foundation.

The GNU General Public License's references to "object code"
and "executables" are to be interpreted as the output of any
document formatting or typesetting system, including
intermediate and printed output.

This manual is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
////
= chrt(1)
:doctype: manpage
:man manual: User Commands
:man source: util-linux {release-version}
:page-layout: base
:command: chrt
:colon: :

== NAME

chrt - manipulate the real-time attributes of a process

== SYNOPSIS

*chrt* [options] _priority command argument_ ...

*chrt* [options] *-p* [_priority_] _PID_

== DESCRIPTION

*chrt* sets or retrieves the real-time scheduling attributes of an existing _PID_, or runs _command_ with the given attributes.

== POLICIES

*-o*, *--other*::
Set scheduling policy to *SCHED_OTHER* (time-sharing scheduling). This is the default Linux scheduling policy.

*-f*, *--fifo*::
Set scheduling policy to *SCHED_FIFO* (first in-first out).

*-r*, *--rr*::
Set scheduling policy to *SCHED_RR* (round-robin scheduling). When no policy is defined, the *SCHED_RR* is used as the default.

*-b*, *--batch*::
Set scheduling policy to *SCHED_BATCH* (scheduling batch processes). Linux-specific, supported since 2.6.16. The priority argument has to be set to zero.

*-i*, *--idle*::
Set 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.

*-d*, *--deadline*::
Set 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.

== SCHEDULING OPTIONS

*-T*, *--sched-runtime* _nanoseconds_::
Specifies runtime parameter for *SCHED_DEADLINE* policy (Linux-specific).

*-P*, *--sched-period* _nanoseconds_::
Specifies period parameter for *SCHED_DEADLINE* policy (Linux-specific). Note that the kernel's lower limit is 100 milliseconds.

*-D*, *--sched-deadline* _nanoseconds_::
Specifies deadline parameter for *SCHED_DEADLINE* policy (Linux-specific).

*-R*, *--reset-on-fork*::
Use *SCHED_RESET_ON_FORK* or *SCHED_FLAG_RESET_ON_FORK* flag. Linux-specific, supported since 2.6.31.
+
Each 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).
+
More precisely, if the _reset-on-fork_ flag is set, the following rules apply for subsequently created children:
+
* If the calling thread has a scheduling policy of *SCHED_FIFO* or *SCHED_RR*, the policy is reset to *SCHED_OTHER* in child processes.
+
* If the calling process has a negative nice value, the nice value is reset to zero in child processes.

== OPTIONS

*-a*, *--all-tasks*::
Set or retrieve the scheduling attributes of all the tasks (threads) for a given PID.

*-m*, *--max*::
Show minimum and maximum valid priorities, then exit.

*-p*, *--pid*::
Operate on an existing PID and do not launch a new task.

*-v*, *--verbose*::
Show status information.

include::man-common/help-version.adoc[]

== EXAMPLES

//TRANSLATORS: Keep {colon} untranslated
The default behavior is to run a new command{colon}::
____
*chrt* _priority_ _command_ [_arguments_]
____
//TRANSLATORS: Keep {colon} untranslated
You can also retrieve the real-time attributes of an existing task{colon}::
____
*chrt -p* _PID_
____
//TRANSLATORS: Keep {colon} untranslated
Or set them{colon}::
____
*chrt -r -p* _priority PID_
____
This, for example, sets real-time scheduling to priority _30_ for the process _PID_ with the *SCHED_RR* (round-robin) class{colon}::
____
*chrt -r -p 30* _PID_
____
Reset priorities to default for a process{colon}::
____
*chrt -o -p 0* _PID_
____
See *sched*(7) for a detailed discussion of the different scheduler classes and how they interact.

== PERMISSIONS

A user must possess *CAP_SYS_NICE* to change the scheduling attributes of a process. Any user can retrieve the scheduling information.

== NOTES

Only *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.

Linux' default scheduling policy is *SCHED_OTHER*.

== AUTHORS

mailto:rml@tech9.net[Robert Love],
mailto:kzak@redhat.com[Karel Zak]

== SEE ALSO

*nice*(1),
*renice*(1),
*taskset*(1),
*sched*(7)

See *sched_setscheduler*(2) for a description of the Linux scheduling scheme.

include::man-common/bugreports.adoc[]

include::man-common/footer.adoc[]

ifdef::translation[]
include::man-common/translation.adoc[]
endif::[]