freebsd-dev/usr.sbin/rtprio/rtprio.1

211 lines
5.4 KiB
Groff
Raw Normal View History

.\"
.\" 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$
.\"
.Dd July 23, 1994
.Dt RTPRIO 1
2001-07-15 08:06:20 +00:00
.Os
.Sh NAME
.Nm rtprio ,
.Nm idprio
2001-07-15 08:06:20 +00:00
.Nd execute, examine or modify a utility's or process's realtime
or idletime scheduling priority
.Sh SYNOPSIS
.Nm [id|rt]prio
2001-07-15 08:06:20 +00:00
.Nm [id|rt]prio
.Oo Fl Oc Ns Ar pid
2001-07-15 08:06:20 +00:00
.Nm [id|rt]prio
.Ar priority
.Ar command
.Op args
2001-07-15 08:06:20 +00:00
.Nm [id|rt]prio
.Ar priority
.Fl Ar pid
2001-07-15 08:06:20 +00:00
.Nm [id|rt]prio
.Fl t
.Ar command
.Op args
2001-07-15 08:06:20 +00:00
.Nm [id|rt]prio
.Fl t
.Fl Ar pid
.Sh DESCRIPTION
2002-04-20 12:27:18 +00:00
The
.Nm
utility is used for controlling realtime process scheduling.
.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
.Nm .
.Pp
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.
.Pp
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
greater than all other runnable idle priority processes.
.Pp
2002-04-20 12:27:18 +00:00
Both
.Nm
or
2001-07-15 08:06:20 +00:00
.Nm idprio
when called without arguments will return the realtime priority
of the current process.
.Pp
If
.Nm
is called with 1 argument, it will return the realtime priority
of the process with the specified
.Ar pid .
.Pp
2001-07-15 08:06:20 +00:00
If
.Ar priority
is specified, the process or program is run at that realtime priority.
2001-07-15 08:06:20 +00:00
If
.Fl t
is specified, the process or program is run as a normal (non-realtime)
2001-07-15 08:06:20 +00:00
process.
.Pp
If
.Ar -pid
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
is specified, that program is run with its arguments.
.Pp
.Ar Priority
is an integer between 0 and RTP_PRIO_MAX (usually 31). 0 is the
highest priority
.Pp
.Ar Pid
of 0 means "the current process".
.Pp
Only root is allowed to set realtime or idle priority for a process.
.Sh DIAGNOSTICS
If
.Nm
execute a command, the exit value is that of the command executed.
In all other cases,
.Nm
exits 0 on success, and 1 for all other errors.
.Sh EXAMPLES
To see which realtime priority the current process is at:
.Bd -literal -offset indent -compact
.Sy "rtprio"
.Ed
.Pp
To see which realtime priority of process
.Em 1423 :
.Bd -literal -offset indent -compact
.Sy "rtprio 1423"
.Ed
.Pp
To run
.Xr cron 8
at the lowest realtime priority:
.Bd -literal -offset indent -compact
.Sy "rtprio 31 cron"
.Ed
.Pp
To change the realtime priority of process
.Em 1423
to
.Em 16 :
.Bd -literal -offset indent -compact
.Sy "rtprio 16 -1423"
.Ed
.Pp
To run
1999-08-18 05:55:22 +00:00
.Xr tcpdump 1
without realtime priority:
.Bd -literal -offset indent -compact
.Sy "rtprio -t tcpdump"
.Ed
.Pp
To change the realtime priority of process
.Em 1423
to
.Dv RTP_PRIO_NORMAL
(non-realtime/normal priority):
.Bd -literal -offset indent -compact
.Sy "rtprio -t -1423"
.Ed
.Pp
To make depend while not disturbing other machine usage:
.Bd -literal -offset indent -compact
.Sy "idprio 31 make depend"
.Ed
.Sh SEE ALSO
.Xr nice 1 ,
.Xr ps 1 ,
1997-01-20 00:03:00 +00:00
.Xr rtprio 2 ,
.Xr setpriority 2 ,
.Xr nice 3 ,
.Xr renice 8
.Sh HISTORY
The
.Nm
utility appeared in
1996-08-23 00:57:08 +00:00
.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
.Xr ps 1 ) .
.Pp
There is in
2000-11-14 11:20:58 +00:00
.Fx
no way to ensure that a process page is present in memory therefore
the process may be stopped for pagein (see
.Xr mprotect 2 ,
.Xr madvise 2 ) .
.Pp
Under
2000-11-14 11:20:58 +00:00
.Fx
system calls are currently never preempted, therefore non-realtime
processes can starve realtime processes, or idletime processes can
starve normal priority processes.
.Sh AUTHORS
.An -nosplit
.An Henrik Vestergaard Draboel Aq hvd@terry.ping.dk
is the original author.
This
1996-08-23 00:57:08 +00:00
implementation in
2000-11-14 11:20:58 +00:00
.Fx
was substantially rewritten by
.An David Greenman .