xref: /netbsd-src/usr.sbin/schedctl/schedctl.8 (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1.\"	$NetBSD: schedctl.8,v 1.9 2008/10/18 03:40:18 rmind Exp $
2.\"
3.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Mindaugas Rasiukevicius <rmind at NetBSD org>.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd October 18, 2008
31.Dt SCHEDCTL 8
32.Os
33.Sh NAME
34.Nm schedctl
35.Nd control scheduling of processes and threads
36.Sh SYNOPSIS
37.Nm
38.Op Fl A Ar cpus
39.Op Fl C Ar class
40.Op Fl P Ar pri
41.Op Fl t Ar lid
42.Fl p Ar pid | Ar command
43.Sh DESCRIPTION
44The
45.Nm
46command can be used to control the scheduling of processes and threads.
47It also returns information about the current scheduling parameters
48of the process or thread.
49Only the super-user may change the scheduling parameters.
50.Nm
51can also be used to start a new command using the specified parameters.
52.Pp
53Available options:
54.Bl -tag -width indent
55.It Fl A Ar cpus
56Set of the processors on which process or thread should run, that
57is, affinity.
58Processors are defined as numbers (starting from zero) and separated
59by commas.
60A value of \-1 is used to unset the affinity.
61.It Fl C Ar class
62Scheduling class (policy), one of:
63.Bl -tag -width SCHEDOTHERXX
64.It Dv SCHED_OTHER
65Time-sharing (TS) scheduling policy.
66The default policy in
67.Nx .
68.It Dv SCHED_FIFO
69First in, first out (FIFO) scheduling policy.
70.It Dv SCHED_RR
71Round-robin scheduling policy.
72.El
73.It Fl P Ar pri
74Priority for the process or thread.
75Value should be in the range from
76.Dv SCHED_PRI_MIN
77(0) to
78.Dv SCHED_PRI_MAX
79(63).
80Setting of priority for the process or thread running at
81.Dv SCHED_OTHER
82policy is not allowed.
83.It Fl p Ar pid
84The target process which will be affected.
85If the process has more than one thread, all of them will be affected.
86.Pp
87If
88.Fl p
89is not given, a command to execute must be given on the command line.
90.It Fl t Ar lid
91Thread in the specified process.
92If specified, only this thread in the process will be affected.
93May only be specified if
94.Fl p
95is also given.
96.El
97.Sh EXAMPLES
98Show scheduling information about the process whose ID is
99.Dq 123 :
100.Bd -literal -offset indent
101# schedctl -p 123
102.Ed
103.Pp
104Set the affinity to CPU 0 and CPU 1, policy to
105.Dv SCHED_RR ,
106and priority to 63
107for thread whose ID is
108.Dq 1
109in process whose ID is
110.Dq 123 :
111.Bd -literal -offset indent
112# schedctl -p 123 -t 1 -A 0,1 -C SCHED_RR -P 63
113.Ed
114.Pp
115Run the
116.Xr top 1
117command with real-time priority:
118.Bd -literal -offset indent
119# schedctl -C SCHED_FIFO top
120.Ed
121.Sh SEE ALSO
122.Xr nice 1 ,
123.Xr getpriority 2 ,
124.Xr setpriority 2 ,
125.Xr psrset 8 ,
126.Xr renice 8
127.Sh HISTORY
128The
129.Nm
130command first appeared in
131.Nx 5.0 .
132