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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
|
'\" t
.\" Title: chrt
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.20
.\" Date: 2025-02-26
.\" Manual: User Commands
.\" Source: util-linux 2.41
.\" Language: English
.\"
.TH "CHRT" "1" "2025-02-26" "util\-linux 2.41" "User Commands"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
. mso www.tmac
. am URL
. ad l
. .
. am MTO
. ad l
. .
. LINKSTYLE blue R < >
.\}
.SH "NAME"
chrt \- manipulate the real\-time attributes of a process
.SH "SYNOPSIS"
.sp
\fBchrt\fP [options] \fIpriority command argument\fP ...
.sp
\fBchrt\fP [options] \fB\-p\fP [\fIpriority\fP] \fIPID\fP
.SH "DESCRIPTION"
.sp
\fBchrt\fP sets or retrieves the real\-time scheduling attributes of an existing \fIPID\fP, or runs \fIcommand\fP with the given attributes.
.SH "POLICIES"
.sp
\fB\-o\fP, \fB\-\-other\fP
.RS 4
Set scheduling policy to \fBSCHED_OTHER\fP (time\-sharing scheduling). This is the default Linux scheduling policy.
.RE
.sp
\fB\-f\fP, \fB\-\-fifo\fP
.RS 4
Set scheduling policy to \fBSCHED_FIFO\fP (first in\-first out).
.RE
.sp
\fB\-r\fP, \fB\-\-rr\fP
.RS 4
Set scheduling policy to \fBSCHED_RR\fP (round\-robin scheduling). When no policy is defined, the \fBSCHED_RR\fP is used as the default.
.RE
.sp
\fB\-b\fP, \fB\-\-batch\fP
.RS 4
Set scheduling policy to \fBSCHED_BATCH\fP (scheduling batch processes). Linux\-specific, supported since 2.6.16. The priority argument has to be set to zero.
.RE
.sp
\fB\-i\fP, \fB\-\-idle\fP
.RS 4
Set scheduling policy to \fBSCHED_IDLE\fP (scheduling very low priority jobs). Linux\-specific, supported since 2.6.23. The priority argument has to be set to zero.
.RE
.sp
\fB\-d\fP, \fB\-\-deadline\fP
.RS 4
Set scheduling policy to \fBSCHED_DEADLINE\fP (sporadic task model deadline scheduling). Linux\-specific, supported since 3.14. The priority argument has to be set to zero. See also \fB\-\-sched\-runtime\fP, \fB\-\-sched\-deadline\fP and \fB\-\-sched\-period\fP. The relation between the options required by the kernel is runtime \(lA deadline \(lA period. \fBchrt\fP copies \fIperiod\fP to \fIdeadline\fP if \fB\-\-sched\-deadline\fP is not specified and \fIdeadline\fP to \fIruntime\fP if \fB\-\-sched\-runtime\fP is not specified. It means that at least \fB\-\-sched\-period\fP has to be specified. See \fBsched\fP(7) for more details.
.RE
.SH "SCHEDULING OPTIONS"
.sp
\fB\-T\fP, \fB\-\-sched\-runtime\fP \fInanoseconds\fP
.RS 4
Specifies runtime parameter for \fBSCHED_DEADLINE\fP and custom slice length for \fBSCHED_OTHER\fP and \fBSCHED_BATCH\fP policies (Linux\-specific). Note that custom slice length via the runtime parameter is supported since Linux 6.12.
.RE
.sp
\fB\-P\fP, \fB\-\-sched\-period\fP \fInanoseconds\fP
.RS 4
Specifies period parameter for \fBSCHED_DEADLINE\fP policy (Linux\-specific). Note that the kernel\(cqs lower limit is 100 milliseconds.
.RE
.sp
\fB\-D\fP, \fB\-\-sched\-deadline\fP \fInanoseconds\fP
.RS 4
Specifies deadline parameter for \fBSCHED_DEADLINE\fP policy (Linux\-specific).
.RE
.sp
\fB\-R\fP, \fB\-\-reset\-on\-fork\fP
.RS 4
Use \fBSCHED_RESET_ON_FORK\fP or \fBSCHED_FLAG_RESET_ON_FORK\fP flag. Linux\-specific, supported since 2.6.31.
.sp
Each thread has a \fIreset\-on\-fork\fP scheduling flag. When this flag is set, children created by \fBfork\fP(2) do not inherit privileged scheduling policies. After the \fIreset\-on\-fork\fP flag has been enabled, it can be reset only if the thread has the \fBCAP_SYS_NICE\fP capability. This flag is disabled in child processes created by \fBfork\fP(2).
.sp
More precisely, if the \fIreset\-on\-fork\fP flag is set, the following rules apply for subsequently created children:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
. sp -1
. IP \(bu 2.3
.\}
If the calling thread has a scheduling policy of \fBSCHED_FIFO\fP or \fBSCHED_RR\fP, the policy is reset to \fBSCHED_OTHER\fP in child processes.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
. sp -1
. IP \(bu 2.3
.\}
If the calling process has a negative nice value, the nice value is reset to zero in child processes.
.RE
.RE
.SH "OPTIONS"
.sp
\fB\-a\fP, \fB\-\-all\-tasks\fP
.RS 4
Set or retrieve the scheduling attributes of all the tasks (threads) for a given PID.
.RE
.sp
\fB\-m\fP, \fB\-\-max\fP
.RS 4
Show minimum and maximum valid priorities, then exit.
.RE
.sp
\fB\-p\fP, \fB\-\-pid\fP
.RS 4
Operate on an existing PID and do not launch a new task.
.RE
.sp
\fB\-v\fP, \fB\-\-verbose\fP
.RS 4
Show status information.
.RE
.sp
\fB\-h\fP, \fB\-\-help\fP
.RS 4
Display help text and exit.
.RE
.sp
\fB\-V\fP, \fB\-\-version\fP
.RS 4
Display version and exit.
.RE
.SH "EXAMPLES"
.sp
The default behavior is to run a new command:
.RS 4
.RE
.RS 3
.ll -.6i
.sp
\fBchrt\fP \fIpriority\fP \fIcommand\fP [\fIarguments\fP]
.br
.RE
.ll
.sp
You can also retrieve the real\-time attributes of an existing task:
.RS 4
.RE
.RS 3
.ll -.6i
.sp
\fBchrt \-p\fP \fIPID\fP
.br
.RE
.ll
.sp
Or set them:
.RS 4
.RE
.RS 3
.ll -.6i
.sp
\fBchrt \-r \-p\fP \fIpriority PID\fP
.br
.RE
.ll
.sp
This, for example, sets real\-time scheduling to priority \fI30\fP for the process \fIPID\fP with the \fBSCHED_RR\fP (round\-robin) class:
.RS 4
.RE
.RS 3
.ll -.6i
.sp
\fBchrt \-r \-p 30\fP \fIPID\fP
.br
.RE
.ll
.sp
Reset priorities to default for a process:
.RS 4
.RE
.RS 3
.ll -.6i
.sp
\fBchrt \-o \-p 0\fP \fIPID\fP
.br
.RE
.ll
.sp
See \fBsched\fP(7) for a detailed discussion of the different scheduler classes and how they interact.
.SH "PERMISSIONS"
.sp
A user must possess \fBCAP_SYS_NICE\fP to change the scheduling attributes of a process. Any user can retrieve the scheduling information.
.SH "NOTES"
.sp
Only \fBSCHED_FIFO\fP, \fBSCHED_OTHER\fP and \fBSCHED_RR\fP are part of POSIX 1003.1b Process Scheduling. The other scheduling attributes may be ignored on some systems.
.sp
Linux\*(Aq default scheduling policy is \fBSCHED_OTHER\fP.
.SH "AUTHORS"
.sp
.MTO "rml\(attech9.net" "Robert Love" ","
.MTO "kzak\(atredhat.com" "Karel Zak" ""
.SH "SEE ALSO"
.sp
\fBnice\fP(1),
\fBrenice\fP(1),
\fBtaskset\fP(1),
\fBsched\fP(7)
.sp
See \fBsched_setscheduler\fP(2) for a description of the Linux scheduling scheme.
.SH "REPORTING BUGS"
.sp
For bug reports, use the \c
.URL "https://github.com/util\-linux/util\-linux/issues" "issue tracker" "."
.SH "AVAILABILITY"
.sp
The \fBchrt\fP command is part of the util\-linux package which can be downloaded from \c
.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."
|