2 .\" Copyright (c) 1998 HD Associates, Inc.
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd set/get scheduling parameters
38 .Fn sched_setparam "pid_t pid" "const struct sched_param *param"
40 .Fn sched_getparam "pid_t pid" "struct sched_param *param"
44 system call sets the scheduling parameters of the process specified by
46 to the values specified by the
48 structure pointed to by
54 structure must be any integer within the inclusive priority range for
55 the current scheduling policy of the process specified by
57 Higher numerical values for the priority represent higher priorities.
59 In this implementation, if the value of
61 is negative the system call will fail.
63 If a process specified by
65 exists and if the calling process has permission, the scheduling
66 parameters are set for the process whose process ID is equal to
71 is zero, the scheduling parameters are set for the calling process.
73 In this implementation, the policy of when a process can affect
74 the scheduling parameters of another process is specified in
76 as a write-style operation.
78 The target process, whether it is running or not running, will resume
79 execution after all other runnable processes of equal or greater
80 priority have been scheduled to run.
82 If the priority of the process specified by the
84 argument is set higher than that of the lowest priority running process
85 and if the specified process is ready to run, the process specified by
88 argument will preempt a lowest priority running process.
92 sets its own priority lower than that of one or more other nonempty
93 process lists, then the process that is the head of the highest priority
94 list will also preempt the calling process.
95 Thus, in either case, the
96 originating process might not receive notification of the completion of
97 the requested priority change until the higher priority process has
100 In this implementation, when the current scheduling policy for the
103 is normal timesharing (SCHED_OTHER, aka SCHED_NORMAL when not POSIX-source)
104 or the idle policy (SCHED_IDLE when not POSIX-source) then the behavior
105 is as if the process had been running under SCHED_RR with a priority
106 lower than any actual realtime priority.
110 system call will return the scheduling parameters of a process specified
115 structure pointed to by
118 If a process specified by
120 exists and if the calling process has permission,
121 the scheduling parameters for the process whose process ID is equal to
125 In this implementation, the policy of when a process can obtain the
126 scheduling parameters of another process are detailed in
128 as a read-style operation.
132 is zero, the scheduling parameters for the calling process will be
134 In this implementation, the
136 system call will fail if
144 will be set to the corresponding value:
147 The system is not configured to support this functionality.
149 The requesting process doesn not have permission as detailed in
152 No process can be found corresponding to that specified by
157 one or more of the requested scheduling parameters
158 is outside the range defined for the scheduling policy of the specified
162 .Xr sched_get_priority_max 2 ,
163 .Xr sched_get_priority_min 2 ,
164 .Xr sched_getscheduler 2 ,
165 .Xr sched_rr_get_interval 2 ,
166 .Xr sched_setscheduler 2 ,
173 system calls conform to