Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

schedctl(8) [netbsd man page]

SCHEDCTL(8)						    BSD System Manager's Manual 					       SCHEDCTL(8)

NAME
schedctl -- control scheduling of processes and threads SYNOPSIS
schedctl [-A cpus] [-C class] [-P pri] [-t lid] -p pid | command DESCRIPTION
The schedctl command can be used to control the scheduling of processes and threads. It also returns information about the current schedul- ing parameters of the process or thread. Only the super-user may change the scheduling parameters. schedctl can also be used to start a new command using the specified parameters. Available options: -A 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. -C class Scheduling class (policy), one of: SCHED_OTHER Time-sharing (TS) scheduling policy. The default policy in NetBSD. SCHED_FIFO First in, first out (FIFO) scheduling policy. SCHED_RR Round-robin scheduling policy. -P pri Priority for the process or thread. Value should be in the range from SCHED_PRI_MIN (0) to SCHED_PRI_MAX (63). Setting of prior- ity for the process or thread running at SCHED_OTHER policy is not allowed. -p pid The target process which will be affected. If the process has more than one thread, all of them will be affected. If -p is not given, a command to execute must be given on the command line. -t lid Thread in the specified process. If specified, only this thread in the process will be affected. May only be specified if -p is also given. EXAMPLES
Show scheduling information about the process whose ID is ``123'': # schedctl -p 123 Set the affinity to CPU 0 and CPU 1, policy to SCHED_RR, and priority to 63 for thread whose ID is ``1'' in process whose ID is ``123'': # schedctl -p 123 -t 1 -A 0,1 -C SCHED_RR -P 63 Run the top(1) command with real-time priority: # schedctl -C SCHED_FIFO top SEE ALSO
nice(1), getpriority(2), setpriority(2), psrset(8), renice(8) HISTORY
The schedctl command first appeared in NetBSD 5.0. BSD
March 21, 2011 BSD

Check Out this Related Man Page

SCHED(3)						   BSD Library Functions Manual 						  SCHED(3)

NAME
sched_setparam, sched_getparam, sched_setscheduler, sched_getscheduler, sched_get_priority_max, sched_get_priority_min, sched_rr_get_interval, sched_yield -- process scheduling LIBRARY
POSIX Real-time Library (librt, -lrt) SYNOPSIS
#include <sched.h> int sched_setparam(pid_t pid, const struct sched_param *param); int sched_getparam(pid_t pid, struct sched_param *param); int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param); int sched_getscheduler(pid_t pid); int sched_get_priority_max(int policy); int sched_get_priority_min(int policy); int sched_rr_get_interval(pid_t pid, struct timespec *interval); int sched_yield(void); DESCRIPTION
This section describes the functions used to get scheduling information about processes, and control the scheduling of processes. Available scheduling policies (classes) are: SCHED_OTHER Time-sharing (TS) scheduling policy. The default policy in NetBSD. SCHED_FIFO First in, first out (FIFO) scheduling policy. SCHED_RR Round robin scheduling policy. The struct sched_param contains at least one member: sched_priority Specifies the priority of the process. FUNCTIONS
sched_setparam(pid, param) Sets the scheduling parameters for the process specified by pid to param. If the value of pid is equal to zero, then the calling process is used. sched_getparam(pid, param) Gets the scheduling parameters of the process specified by pid into the structure param. If the value of pid is equal to zero, then the calling process is used. sched_setscheduler(pid, policy, param) Set the scheduling policy and parameters for the process specified by pid. If the value of pid is equal to zero, then the calling process is used. sched_getscheduler(pid) Returns the scheduling policy of the process specified by pid. If the value of pid is equal to zero, then the calling process is used. sched_get_priority_max(policy) Returns the maximal priority which may be used for the scheduling policy specified by policy. sched_get_priority_min(policy) Returns the minimal priority which may be used for the scheduling policy specified by policy. sched_rr_get_interval(pid, interval) Returns the time quantum into the structure interval of the process specified by pid. If the value of pid is equal to zero, then the calling process is used. The process must be running at SCHED_RR scheduling policy. sched_yield() Yields a processor voluntarily and gives other threads a chance to run without waiting for an involuntary preemptive switch. sched_setaffinity_np(pid, size, cpuset) Set the affinity mask specified by cpuset for the process specified by pid. At least one valid CPU must be set in the mask. sched_getaffinity_np(pid, size, cpuset) Get the affinity mask of the process specified by pid into the cpuset. IMPLEMENTATION NOTES
Setting CPU affinity(3) requires super-user privileges. Ordinary users can be allowed to control CPU affinity of their threads via the security.models.extensions.user_set_cpu_affinity sysctl(7). See secmodel_extensions(9). Portable applications should not use the sched_setaffinity_np() and sched_getaffinity_np() functions. RETURN VALUES
sched_setparam(), sched_getparam(), sched_rr_get_interval(), and sched_yield() return 0 on success. Otherwise, -1 is returned and errno is set to indicate the error. sched_setscheduler() returns the previously used scheduling policy on success. Otherwise, -1 is returned and errno is set to indicate the error. sched_getscheduler() returns the scheduling policy on success. Otherwise, -1 is returned and errno is set to indicate the error. sched_get_priority_max() and sched_get_priority_min() return the maximal/minimal priority value on success. Otherwise, -1 is returned and errno is set to indicate the error. sched_setaffinity_np() and sched_getaffinity_np() return 0 on success. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The sched_setparam() and sched_setscheduler() functions fail if: [EINVAL] At least one of the specified scheduling parameters was invalid. [EPERM] The calling process has no appropriate privileges to perform the operation. [ESRCH] No process can be found corresponding to the PID specified by pid, and the value of pid is not zero. The sched_getparam() and sched_getscheduler() functions fail if: [EPERM] The calling process is not a super-user and its effective user id does not match the effective user-id of the specified process. [ESRCH] No process can be found corresponding to that specified by pid, and the value of pid is not zero. The sched_get_priority_max() and sched_get_priority_min() functions fail if: [EINVAL] The specified scheduling policy is invalid. The sched_rr_get_interval() function fails if: [ESRCH] No process can be found corresponding to that specified by pid, and the value of pid is not zero. SEE ALSO
affinity(3), cpuset(3), pset(3), schedctl(8) STANDARDS
These functions, except sched_setaffinity_np() and sched_getaffinity_np(), are expected to conform the IEEE Std 1003.1-2001 (``POSIX.1'') standard. HISTORY
The scheduling functions appeared in NetBSD 5.0. BSD
December 4, 2011 BSD
Man Page