Copyright (c) 2008 The NetBSD Foundation, Inc.
All rights reserved.
This code is derived from software contributed to The NetBSD Foundation
by Mindaugas Rasiukevicius <rmind at NetBSD org>.
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.
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
.Dd June 22, 2008 .Dt SCHEDCTL 8 .Os .Sh NAME .Nm schedctl .Nd control scheduling of processes and threads .Sh SYNOPSIS .Nm .Op Fl A Ar cpus .Op Fl C Ar class .Op Fl P Ar pri .Op Fl t Ar lid .Fl p Ar pid | Ar command .Sh DESCRIPTION The .Nm command can be used to control the scheduling of processes and threads. It also returns information about the current scheduling parameters of the process or thread. Only the super-user may change the scheduling parameters. .Nm can also be used to start a new command using the specified parameters.
p Available options: l -tag -width indent t Fl A Ar cpus Set of the processors on which process or thread should run, that is, affinity. Processors are defined as numbers (starting from zero) and separated by commas. A value of -1 is used to unset the affinity. t Fl C Ar class Scheduling class (policy), one of: l -tag -width SCHEDOTHERXX t Dv SCHED_OTHER Time-sharing (TS) scheduling policy. The default policy in .Nx . t Dv SCHED_FIFO First in, first out (FIFO) scheduling policy. t Dv SCHED_RR Round-robin scheduling policy. .El t Fl P Ar pri Priority which will be set for the process or thread. For all scheduling classes, priority might be set to any value in the range from .Dv SCHED_PRI_MIN (0) to .Dv SCHED_PRI_MAX (63). t Fl p Ar pid The target process which will be affected. If the process has more than one thread, all of them will be affected.
p If .Fl p is not given, a command to execute must be given on the command line. t Fl t Ar lid Thread in the specified process. If specified, only this thread in the process will be affected. May only be specified if .Fl p is also given. .El .Sh EXAMPLES Show scheduling information about the process whose ID is .Dq 123 : d -literal -offset indent # schedctl -p 123 .Ed
p Set the affinity to CPU 0 and CPU 1, policy to .Dv SCHED_RR , and priority to 63 for thread whose ID is .Dq 1 in process whose ID is .Dq 123 : d -literal -offset indent # schedctl -p 123 -t 1 -A 0,1 -C 2 -P 63 .Ed
p Run the .Xr top 1 command with real-time priority: d -literal -offset indent # schedctl -C SCHED_FIFO top .Ed .Sh SEE ALSO .Xr nice 1 , .Xr getpriority 2 , .Xr setpriority 2 , .Xr psrset 8 , .Xr renice 8 .Sh HISTORY The .Nm command first appeared in .Nx 5.0 .