| 1 |
//po4a: entry man manual |
| 2 |
//// |
| 3 |
chrt(1) manpage |
| 4 |
|
| 5 |
Copyright (C) 2004 Robert Love |
| 6 |
Copyright (C) 2015 Karel Zak <[email protected]> |
| 7 |
|
| 8 |
This is free documentation; you can redistribute it and/or |
| 9 |
modify it under the terms of the GNU General Public License, |
| 10 |
version 2, as published by the Free Software Foundation. |
| 11 |
|
| 12 |
The GNU General Public License's references to "object code" |
| 13 |
and "executables" are to be interpreted as the output of any |
| 14 |
document formatting or typesetting system, including |
| 15 |
intermediate and printed output. |
| 16 |
|
| 17 |
This manual is distributed in the hope that it will be useful, |
| 18 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
GNU General Public License for more details. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License |
| 23 |
along with this program. If not, see <https://gnu.org/licenses/>. |
| 24 |
//// |
| 25 |
ifdef::neverdefined[---] |
| 26 |
|
| 27 |
= chrt(1) |
| 28 |
:doctype: manpage |
| 29 |
:man manual: User Commands |
| 30 |
:man source: util-linux {release-version} |
| 31 |
:page-layout: base |
| 32 |
:command: chrt |
| 33 |
:colon: : |
| 34 |
|
| 35 |
== NAME |
| 36 |
|
| 37 |
chrt - manipulate the real-time attributes of a process |
| 38 |
|
| 39 |
== SYNOPSIS |
| 40 |
|
| 41 |
*chrt* [options] [_priority_] _command_ [_argument_...] |
| 42 |
|
| 43 |
*chrt --pid* [options] [_priority_] _PID_ |
| 44 |
|
| 45 |
== DESCRIPTION |
| 46 |
|
| 47 |
*chrt* sets or retrieves the real-time scheduling attributes of an existing _PID_, or runs _command_ with the given attributes. |
| 48 |
|
| 49 |
== POLICY OPTIONS |
| 50 |
|
| 51 |
*-o*, *--other*:: |
| 52 |
Set scheduling policy to *SCHED_OTHER* (time-sharing scheduling). This is the default Linux scheduling policy. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero. |
| 53 |
|
| 54 |
*-f*, *--fifo*:: |
| 55 |
Set scheduling policy to *SCHED_FIFO* (first in-first out). |
| 56 |
|
| 57 |
*-r*, *--rr*:: |
| 58 |
Set scheduling policy to *SCHED_RR* (round-robin scheduling). When no policy is defined, the *SCHED_RR* is used as the default. |
| 59 |
|
| 60 |
*-b*, *--batch*:: |
| 61 |
Set scheduling policy to *SCHED_BATCH* (scheduling batch processes). Linux-specific, supported since 2.6.16. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero. |
| 62 |
|
| 63 |
*-i*, *--idle*:: |
| 64 |
Set scheduling policy to *SCHED_IDLE* (scheduling very low priority jobs). Linux-specific, supported since 2.6.23. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero. |
| 65 |
|
| 66 |
*-d*, *--deadline*:: |
| 67 |
Set scheduling policy to *SCHED_DEADLINE* (sporadic task model deadline scheduling). Linux-specific, supported since 3.14. Since util-linux v2.42, the priority argument is optional; if specified, it must 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. |
| 68 |
|
| 69 |
*-e*, *--ext*:: |
| 70 |
Set scheduling policy to *SCHED_EXT* (BPF program-defined scheduling). Linux-specific, supported since 6.12. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero. |
| 71 |
Note that for the policy to be recognized, the following kernel configuration options need to be enabled: *CONFIG_BPF*, *CONFIG_SCHED_CLASS_EXT*, *CONFIG_BPF_SYSCALL*, *CONFIG_BPF_JIT*, *CONFIG_DEBUG_INFO_BTF*, *CONFIG_BPF_JIT_ALWAYS_ON* and *CONFIG_BPF_JIT_DEFAULT_ON*. |
| 72 |
|
| 73 |
== SCHEDULING OPTIONS |
| 74 |
|
| 75 |
*-T*, *--sched-runtime* _nanoseconds_:: |
| 76 |
Specifies runtime parameter for *SCHED_DEADLINE* and custom slice length for *SCHED_OTHER* and *SCHED_BATCH* policies (Linux-specific). Note that custom slice length via the runtime parameter is supported since Linux 6.12. |
| 77 |
|
| 78 |
*-P*, *--sched-period* _nanoseconds_:: |
| 79 |
Specifies period parameter for *SCHED_DEADLINE* policy (Linux-specific). Note that the kernel's lower limit is 100 microseconds. |
| 80 |
|
| 81 |
*-D*, *--sched-deadline* _nanoseconds_:: |
| 82 |
Specifies deadline parameter for *SCHED_DEADLINE* policy (Linux-specific). |
| 83 |
|
| 84 |
*-R*, *--reset-on-fork*:: |
| 85 |
Use *SCHED_RESET_ON_FORK* or *SCHED_FLAG_RESET_ON_FORK* flag. Linux-specific, supported since 2.6.31. |
| 86 |
+ |
| 87 |
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). |
| 88 |
+ |
| 89 |
More precisely, if the _reset-on-fork_ flag is set, the following rules apply for subsequently created children: |
| 90 |
+ |
| 91 |
* If the calling thread has a scheduling policy of *SCHED_FIFO* or *SCHED_RR*, the policy is reset to *SCHED_OTHER* in child processes. |
| 92 |
+ |
| 93 |
* If the calling process has a negative nice value, the nice value is reset to zero in child processes. |
| 94 |
|
| 95 |
== OPTIONS |
| 96 |
|
| 97 |
*-a*, *--all-tasks*:: |
| 98 |
Set or retrieve the scheduling attributes of all the tasks (threads) for a given PID. |
| 99 |
|
| 100 |
*-m*, *--max*:: |
| 101 |
Show minimum and maximum valid priorities, then exit. |
| 102 |
|
| 103 |
*-p*, *--pid*:: |
| 104 |
Operate on an existing PID and do not launch a new task. |
| 105 |
|
| 106 |
*-v*, *--verbose*:: |
| 107 |
Show status information. |
| 108 |
|
| 109 |
include::man-common/help-version.adoc[] |
| 110 |
|
| 111 |
== EXAMPLES |
| 112 |
|
| 113 |
//TRANSLATORS: Keep {colon} untranslated |
| 114 |
The default behavior is to run a new command{colon}:: |
| 115 |
____ |
| 116 |
*chrt* _priority_ _command_ [_arguments_] |
| 117 |
____ |
| 118 |
//TRANSLATORS: Keep {colon} untranslated |
| 119 |
You can also retrieve the real-time attributes of an existing task{colon}:: |
| 120 |
____ |
| 121 |
*chrt --pid* _PID_ |
| 122 |
____ |
| 123 |
//TRANSLATORS: Keep {colon} untranslated |
| 124 |
Or set them{colon}:: |
| 125 |
____ |
| 126 |
*chrt --pid* _policy-option priority PID_ |
| 127 |
____ |
| 128 |
For example, to set the scheduling policy to *SCHED_RR* (round-robin) and the priority to *30* for process *1234*{colon}:: |
| 129 |
____ |
| 130 |
*chrt --pid -r 30 1234* |
| 131 |
____ |
| 132 |
Reset priorities to default for a process{colon}:: |
| 133 |
____ |
| 134 |
*chrt --pid -o 0* _PID_ |
| 135 |
____ |
| 136 |
Set a custom slice of 1 ms for a *SCHED_OTHER* task (priority is optional for policies other than *SCHED_FIFO* and *SCHED_RR*){colon}:: |
| 137 |
____ |
| 138 |
*chrt --pid -o -T 1000000* _PID_ |
| 139 |
____ |
| 140 |
See *sched*(7) for a detailed discussion of the different scheduler classes and how they interact. |
| 141 |
|
| 142 |
== PERMISSIONS |
| 143 |
|
| 144 |
A user must possess *CAP_SYS_NICE* to change the scheduling attributes of a process. Any user can retrieve the scheduling information. |
| 145 |
|
| 146 |
== NOTES |
| 147 |
|
| 148 |
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. |
| 149 |
|
| 150 |
Linux' default scheduling policy is *SCHED_OTHER*. |
| 151 |
|
| 152 |
== AUTHORS |
| 153 |
|
| 154 |
mailto:[email protected][Robert Love], |
| 155 |
mailto:[email protected][Karel Zak] |
| 156 |
|
| 157 |
== SEE ALSO |
| 158 |
|
| 159 |
*nice*(1), |
| 160 |
*renice*(1), |
| 161 |
*taskset*(1), |
| 162 |
*sched*(7) |
| 163 |
|
| 164 |
See *sched_setscheduler*(2) for a description of the Linux scheduling scheme. |
| 165 |
|
| 166 |
include::man-common/bugreports.adoc[] |
| 167 |
|
| 168 |
include::man-common/footer.adoc[] |
| 169 |
|
| 170 |
ifdef::translation[] |
| 171 |
include::man-common/translation.adoc[] |
| 172 |
endif::[] |