summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rtprio/rtprio.1
blob: 4a96437b378c7f454e54793a342f8066a325bab8 (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
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
.\"
.\" Copyright (c) 1994, Henrik Vestergaard Draboel
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by Henrik Vestergaard Draboel.
.\" 4. The name of the author may not be used to endorse or promote products
.\"    derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"	$Id: rtprio.1,v 1.5 1996/02/11 22:36:44 mpp Exp $
.\"
.Dd July 23, 1994
.Dt RTPRIO 1
.Os 
.Sh NAME
.Nm rtprio ,
.Nm idprio
.Nd execute, examine or modify a utilitys or process realtime 
or idletime scheduling priority
.Sh SYNOPSIS

.Nm [id|rt]prio
.Nm [id|rt]prio 
.Ar pid
.Nm [id|rt]prio 
.Ar priority
.Ar command
.Op args
.Nm [id|rt]prio 
.Ar priority
.Ar -pid
.Nm [id|rt]prio 
.Ar -t
.Ar command
.Op args
.Nm [id|rt]prio 
.Ar -t
.Ar -pid
.Sh DESCRIPTION
.Nm Rtprio
is used for controlling realtime process scheduling. 

.Nm Idprio
is used for controlling idletime process scheduling, and can be called
with the same options as 
.Nm Rtprio .

A process with a realtime priority is not subject to priority
degradation, and will only be preempted by another process of equal or
higher realtime priority.

A process with an idle priority will run only when no other
process is runnable and then only if it's idle priority is equal or
greater than all other runnable idle priority processes.

.Nm Rtprio 
or
.Nm Idprio 
when called without arguments will return the realtime priority
of the current process.

If
.Nm rtprio
is called with 1 argument, it will return the realtime priority
of the process with the specified
.Ar pid .

If 
.Ar priority
is specified, the process or program is run at that realtime priority.
If 
.Ar -t
is specified, the process or program is run as a normal (non-realtime)
process. 

If
.Ar -pid
is specified, the process with the process identifier "pid" will be
modified, else if
.Ar command 
is specified, that program is run with its arguments.

.Ar Priority
is an integer between 0 and RTP_PRIO_MAX (usually 31). 0 is the
highest priority

.Ar Pid
of 0 means "the current process".

Only root is allowed to set realtime priorities. Non-root processes may
set idle priority levels for the current process only.
.Sh RETURN VALUE
If
.Nm rtprio
execute a command, the exit value is that of the command executed.
In all other cases,
.Nm
exits with 0 for success and 1 for all other errors.
.Sh EXAMPLES
.\LP

To see which realtime priority the current process is at:
.Bd -literal -offset indent -compact
\fBrtprio\fP
.Ed

.\.LP
To see which realtime priority of process \fI1423\fP:
.Bd -literal -offset indent -compact
\fBrtprio 1423\fP
.Ed

.\.LP
To run \fIcron\fP at the lowest realtime priority:
.Bd -literal -offset indent -compact
\fBrtprio 31 cron\fP
.Ed

.\.LP
To change the realtime priority of process \fI1423\fP to \fI16\fP:
.Bd -literal -offset indent -compact
\fBrtprio 16 -1423\fP
.Ed

.\.LP
To run \fItcpdump\fP without realtime priority:
.Bd -literal -offset indent -compact
\fBrtprio -t tcpdump\fP
.Ed

.\.LP
To change the realtime priority of process \fI1423\fP to RTP_PRIO_NORMAL
(non-realtime/"normal" priority):
.Bd -literal -offset indent -compact
\fBrtprio -t -1423\fP
.Ed

.\.LP
To make depend while not disturbing other machine usage:
.Bd -literal -offset indent -compact
\fBidprio 31 make depend\fP
.Ed
.Sh SEE ALSO
.Xr rtprio 2 ,
.Xr nice 1 ,
.Xr ps 1 ,
.Xr setpriority 2 ,
.Xr nice 3 ,
.Xr renice 8
.Sh HISTORY
The
.Nm rtprio
utility appeared in
.Fx 2.0 ,
but is similar to the HP-UX version.
.Sh CAVEATS
You can lock yourself out of the system by placing a cpu-heavy
process in a realtime priority.
.Sh BUGS
There is no way to set/view the realtime priority of process 0
(swapper) (see ps(1)).

There is in
.Tn FreeBSD
no way to ensure that a process page is present in memory therefore
the process may be stopped for pagein. (See mprotect(2), madvise(2)).

Under
.Tn FreeBSD
system calls are currently never preempted, therefore non-realtime
processes can starve realtime processes, or idletime processes can
starve normal priority processes.

Others ...
.Sh AUTHOR
Henrik Vestergaard Draboel - hvd@terry.ping.dk is the original author. This
implementation in
.Tn FreeBSD 
was substantially rewritten by David Greenman.
OpenPOWER on IntegriCloud