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.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the NetBSD
Foundation, Inc. and its contributors.
4. Neither the name of The NetBSD Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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 January 24, 2008 .Dt SCHEDCTL 8 .Os .Sh NAME .Nm schedctl .Nd control scheduling of processes and threads .Sh SYNOPSIS .Nm .Fl p Ar pid .Op Fl A Ar processors .Op Fl C Ar class .Op Fl P Ar priority .Op Fl t Ar lid .Sh DESCRIPTION The .Nm command can be used to control the scheduling of processes and threads. It also returns information about current scheduling parameters of the process or thread. Only the super-user may change the scheduling parameters.
p Available options: l -tag -width indent t Fl A Ar processors 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) might be: l -tag -width SCHEDOTHERXX t Dv 0: SCHED_OTHER Time-sharing (TS) scheduling policy. The default policy in .Nx . t Dv 1: SCHED_FIFO First in, first out (FIFO) scheduling policy. t Dv 2: SCHED_RR Round-robin scheduling policy. .El t Fl P Ar priority 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. t Fl t Ar lid Thread in the specified process. If specified, only this thread in the process will be affected. .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 .Sh SEE ALSO .Xr nice 1 , .Xr getpriority 2 , .Xr setpriority 2 , .Xr renice 8 .Sh HISTORY The .Nm command first appeared in .Nx 5.0 .