1994-09-01 12:05:14 +00:00
|
|
|
.\"
|
|
|
|
.\" 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.
|
|
|
|
.\"
|
1999-08-28 01:35:59 +00:00
|
|
|
.\" $FreeBSD$
|
1994-09-01 12:05:14 +00:00
|
|
|
.\"
|
2012-09-30 03:21:21 +00:00
|
|
|
.Dd September 29, 2012
|
1994-09-01 12:05:14 +00:00
|
|
|
.Dt RTPRIO 1
|
2001-07-15 08:06:20 +00:00
|
|
|
.Os
|
1994-09-01 12:05:14 +00:00
|
|
|
.Sh NAME
|
1994-10-02 04:48:21 +00:00
|
|
|
.Nm rtprio ,
|
|
|
|
.Nm idprio
|
2001-07-15 08:06:20 +00:00
|
|
|
.Nd execute, examine or modify a utility's or process's realtime
|
1994-10-02 04:48:21 +00:00
|
|
|
or idletime scheduling priority
|
1994-09-01 12:05:14 +00:00
|
|
|
.Sh SYNOPSIS
|
1994-10-02 04:48:21 +00:00
|
|
|
.Nm [id|rt]prio
|
2001-07-15 08:06:20 +00:00
|
|
|
.Nm [id|rt]prio
|
2001-02-01 16:44:04 +00:00
|
|
|
.Oo Fl Oc Ns Ar pid
|
2001-07-15 08:06:20 +00:00
|
|
|
.Nm [id|rt]prio
|
1994-09-01 12:05:14 +00:00
|
|
|
.Ar priority
|
|
|
|
.Ar command
|
|
|
|
.Op args
|
2001-07-15 08:06:20 +00:00
|
|
|
.Nm [id|rt]prio
|
1994-09-01 12:05:14 +00:00
|
|
|
.Ar priority
|
2001-02-01 16:44:04 +00:00
|
|
|
.Fl Ar pid
|
2001-07-15 08:06:20 +00:00
|
|
|
.Nm [id|rt]prio
|
1997-03-07 07:43:19 +00:00
|
|
|
.Fl t
|
1994-09-01 12:05:14 +00:00
|
|
|
.Ar command
|
|
|
|
.Op args
|
2001-07-15 08:06:20 +00:00
|
|
|
.Nm [id|rt]prio
|
1997-03-07 07:43:19 +00:00
|
|
|
.Fl t
|
2001-02-01 16:44:04 +00:00
|
|
|
.Fl Ar pid
|
1994-09-01 12:05:14 +00:00
|
|
|
.Sh DESCRIPTION
|
2002-04-20 12:27:18 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is used for controlling realtime process scheduling.
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
2002-04-20 12:27:18 +00:00
|
|
|
The
|
|
|
|
.Nm idprio
|
|
|
|
utility is used for controlling idletime process scheduling, and can be called
|
2001-07-15 08:06:20 +00:00
|
|
|
with the same options as
|
2000-11-20 20:10:44 +00:00
|
|
|
.Nm .
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
1994-10-02 04:48:21 +00:00
|
|
|
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.
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
1994-10-02 04:48:21 +00:00
|
|
|
A process with an idle priority will run only when no other
|
1997-12-28 20:52:56 +00:00
|
|
|
process is runnable and then only if its idle priority is equal or
|
1994-10-02 04:48:21 +00:00
|
|
|
greater than all other runnable idle priority processes.
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
2002-04-20 12:27:18 +00:00
|
|
|
Both
|
|
|
|
.Nm
|
1994-10-02 04:48:21 +00:00
|
|
|
or
|
2001-07-15 08:06:20 +00:00
|
|
|
.Nm idprio
|
1994-10-02 04:48:21 +00:00
|
|
|
when called without arguments will return the realtime priority
|
1994-09-01 12:05:14 +00:00
|
|
|
of the current process.
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
1994-09-01 12:05:14 +00:00
|
|
|
If
|
1997-10-13 11:24:01 +00:00
|
|
|
.Nm
|
1994-09-01 12:05:14 +00:00
|
|
|
is called with 1 argument, it will return the realtime priority
|
|
|
|
of the process with the specified
|
|
|
|
.Ar pid .
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
2001-07-15 08:06:20 +00:00
|
|
|
If
|
1994-09-01 12:05:14 +00:00
|
|
|
.Ar priority
|
|
|
|
is specified, the process or program is run at that realtime priority.
|
2001-07-15 08:06:20 +00:00
|
|
|
If
|
1997-03-07 07:43:19 +00:00
|
|
|
.Fl t
|
1994-09-01 12:05:14 +00:00
|
|
|
is specified, the process or program is run as a normal (non-realtime)
|
2001-07-15 08:06:20 +00:00
|
|
|
process.
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
1994-09-01 12:05:14 +00:00
|
|
|
If
|
|
|
|
.Ar -pid
|
1997-10-13 11:24:01 +00:00
|
|
|
is specified, the process with the process identifier
|
|
|
|
.Ar pid
|
|
|
|
will be modified, else if
|
2001-07-15 08:06:20 +00:00
|
|
|
.Ar command
|
1994-09-01 12:05:14 +00:00
|
|
|
is specified, that program is run with its arguments.
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
1994-09-01 12:05:14 +00:00
|
|
|
.Ar Priority
|
2004-07-02 23:13:00 +00:00
|
|
|
is an integer between 0 and RTP_PRIO_MAX (usually 31).
|
|
|
|
0 is the
|
1994-09-01 12:05:14 +00:00
|
|
|
highest priority
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
1994-09-01 12:05:14 +00:00
|
|
|
.Ar Pid
|
|
|
|
of 0 means "the current process".
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
1998-03-12 01:29:12 +00:00
|
|
|
Only root is allowed to set realtime or idle priority for a process.
|
2012-09-30 03:21:21 +00:00
|
|
|
A user may modify the idle priority of their own processes if the
|
|
|
|
.Xr sysctl 8
|
|
|
|
variable
|
|
|
|
.Va security.bsd.unprivileged_idprio
|
|
|
|
is set to non-zero.
|
|
|
|
Note that this increases the chance that a deadlock can occur
|
|
|
|
if a process locks a required resource and then does
|
|
|
|
not get to run.
|
2005-01-17 07:44:44 +00:00
|
|
|
.Sh EXIT STATUS
|
1994-10-02 04:48:21 +00:00
|
|
|
If
|
1997-10-13 11:24:01 +00:00
|
|
|
.Nm
|
1994-10-02 04:48:21 +00:00
|
|
|
execute a command, the exit value is that of the command executed.
|
|
|
|
In all other cases,
|
|
|
|
.Nm
|
1999-11-27 17:10:35 +00:00
|
|
|
exits 0 on success, and 1 for all other errors.
|
1994-09-01 12:05:14 +00:00
|
|
|
.Sh EXAMPLES
|
|
|
|
To see which realtime priority the current process is at:
|
2005-01-15 12:28:01 +00:00
|
|
|
.Dl rtprio
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
2005-01-15 12:28:01 +00:00
|
|
|
To see which realtime priority of process 1423:
|
|
|
|
.Dl "rtprio 1423"
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
|
|
|
To run
|
|
|
|
.Xr cron 8
|
|
|
|
at the lowest realtime priority:
|
2005-01-15 12:28:01 +00:00
|
|
|
.Dl "rtprio 31 cron"
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
2005-01-15 12:28:01 +00:00
|
|
|
To change the realtime priority of process 1423 to 16:
|
|
|
|
.Dl "rtprio 16 -1423"
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
|
|
|
To run
|
1999-08-18 05:55:22 +00:00
|
|
|
.Xr tcpdump 1
|
1997-03-07 07:43:19 +00:00
|
|
|
without realtime priority:
|
2005-01-15 12:28:01 +00:00
|
|
|
.Dl "rtprio -t tcpdump"
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
2005-01-15 12:28:01 +00:00
|
|
|
To change the realtime priority of process 1423
|
1997-03-07 07:43:19 +00:00
|
|
|
to
|
|
|
|
.Dv RTP_PRIO_NORMAL
|
1997-10-13 11:24:01 +00:00
|
|
|
(non-realtime/normal priority):
|
2005-01-15 12:28:01 +00:00
|
|
|
.Dl "rtprio -t -1423"
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
1994-10-02 04:48:21 +00:00
|
|
|
To make depend while not disturbing other machine usage:
|
2005-01-15 12:28:01 +00:00
|
|
|
.Dl "idprio 31 make depend"
|
1994-09-01 12:05:14 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr nice 1 ,
|
|
|
|
.Xr ps 1 ,
|
1997-01-20 00:03:00 +00:00
|
|
|
.Xr rtprio 2 ,
|
1996-02-11 22:38:05 +00:00
|
|
|
.Xr setpriority 2 ,
|
|
|
|
.Xr nice 3 ,
|
1994-09-01 12:05:14 +00:00
|
|
|
.Xr renice 8
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
1997-10-13 11:24:01 +00:00
|
|
|
.Nm
|
1994-09-01 12:05:14 +00:00
|
|
|
utility appeared in
|
1996-08-23 00:57:08 +00:00
|
|
|
.Fx 2.0 ,
|
1994-09-01 12:05:14 +00:00
|
|
|
but is similar to the HP-UX version.
|
2005-01-18 20:02:45 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
.An -nosplit
|
2014-06-20 09:57:27 +00:00
|
|
|
.An Henrik Vestergaard Draboel Aq Mt hvd@terry.ping.dk
|
2005-01-18 20:02:45 +00:00
|
|
|
is the original author.
|
|
|
|
This
|
|
|
|
implementation in
|
|
|
|
.Fx
|
|
|
|
was substantially rewritten by
|
|
|
|
.An David Greenman .
|
2010-05-13 12:07:55 +00:00
|
|
|
.Sh CAVEATS
|
|
|
|
You can lock yourself out of the system by placing a cpu-heavy
|
|
|
|
process in a realtime priority.
|
1994-09-01 12:05:14 +00:00
|
|
|
.Sh BUGS
|
|
|
|
There is no way to set/view the realtime priority of process 0
|
1997-03-07 07:43:19 +00:00
|
|
|
(swapper) (see
|
1997-03-07 07:45:17 +00:00
|
|
|
.Xr ps 1 ) .
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
1994-10-02 04:48:21 +00:00
|
|
|
There is in
|
2000-11-14 11:20:58 +00:00
|
|
|
.Fx
|
1994-10-02 04:48:21 +00:00
|
|
|
no way to ensure that a process page is present in memory therefore
|
1997-10-13 11:24:01 +00:00
|
|
|
the process may be stopped for pagein (see
|
1997-03-07 07:43:19 +00:00
|
|
|
.Xr mprotect 2 ,
|
1997-03-07 07:45:17 +00:00
|
|
|
.Xr madvise 2 ) .
|
1997-03-07 07:43:19 +00:00
|
|
|
.Pp
|
1994-10-02 04:48:21 +00:00
|
|
|
Under
|
2000-11-14 11:20:58 +00:00
|
|
|
.Fx
|
1994-10-02 04:48:21 +00:00
|
|
|
system calls are currently never preempted, therefore non-realtime
|
1996-01-30 13:52:50 +00:00
|
|
|
processes can starve realtime processes, or idletime processes can
|
1994-10-02 04:48:21 +00:00
|
|
|
starve normal priority processes.
|