1SCHED_SETPARAM(3P)         POSIX Programmer's Manual        SCHED_SETPARAM(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       sched_setparam - set scheduling parameters (REALTIME)
13

SYNOPSIS

15       #include <sched.h>
16
17       int sched_setparam(pid_t pid, const struct sched_param *param);
18
19

DESCRIPTION

21       The sched_setparam() function shall set the  scheduling  parameters  of
22       the process specified by pid to the values specified by the sched_param
23       structure pointed to by param.  The value of the sched_priority  member
24       in  the sched_param structure shall be any integer within the inclusive
25       priority range for the current scheduling policy of the process  speci‐
26       fied  by pid. Higher numerical values for the priority represent higher
27       priorities. If the value of  pid  is  negative,  the  behavior  of  the
28       sched_setparam() function is unspecified.
29
30       If  a  process  specified by pid exists, and if the calling process has
31       permission, the scheduling parameters shall  be  set  for  the  process
32       whose process ID is equal to pid.
33
34       If  pid is zero, the scheduling parameters shall be set for the calling
35       process.
36
37       The conditions under which one process has  permission  to  change  the
38       scheduling parameters of another process are implementation-defined.
39
40       Implementations  may  require the requesting process to have the appro‐
41       priate privilege to set its  own  scheduling  parameters  or  those  of
42       another process.
43
44       The  target  process,  whether  it  is running or not running, shall be
45       moved to the tail of the thread list for its priority.
46
47       If the priority of the process specified by the  pid  argument  is  set
48       higher  than  that  of  the  lowest priority running process and if the
49       specified process is ready to run, the process  specified  by  the  pid
50       argument shall preempt a lowest priority running process. Similarly, if
51       the process calling sched_setparam() sets its own priority  lower  than
52       that  of  one  or  more other non-empty process lists, then the process
53       that is the head of the highest priority list shall  also  preempt  the
54       calling  process.  Thus,  in either case, the originating process might
55       not receive notification of the completion of  the  requested  priority
56       change until the higher priority process has executed.
57
58       If  the  scheduling policy of the target process is SCHED_SPORADIC, the
59       value specified by the sched_ss_low_priority member of the param  argu‐
60       ment  shall  be any integer within the inclusive priority range for the
61       sporadic server policy. The sched_ss_repl_period and sched_ss_init_bud‐
62       get  members  of the param argument shall represent the time parameters
63       to be used by the sporadic server  scheduling  policy  for  the  target
64       process.  The sched_ss_max_repl member of the param argument shall rep‐
65       resent the maximum number of replenishments  that  are  allowed  to  be
66       pending  simultaneously for the process scheduled under this scheduling
67       policy.
68
69       The specified sched_ss_repl_period shall be greater than  or  equal  to
70       the  specified  sched_ss_init_budget for the function to succeed; if it
71       is not, then the function shall fail.
72
73       The value of sched_ss_max_repl shall be within the inclusive range  [1,
74       {SS_REPL_MAX}]  for the function to succeed; if not, the function shall
75       fail.
76
77       If the scheduling policy of the target process is either SCHED_FIFO  or
78       SCHED_RR,    the   sched_ss_low_priority,   sched_ss_repl_period,   and
79       sched_ss_init_budget members of the param argument shall have no effect
80       on the scheduling behavior. If the scheduling policy of this process is
81       not SCHED_FIFO, SCHED_RR, or SCHED_SPORADIC, the effects of these  mem‐
82       bers  are  implementation-defined;  this  case includes the SCHED_OTHER
83       policy.
84
85       If the current scheduling policy for the process specified  by  pid  is
86       not SCHED_FIFO, SCHED_RR,  or SCHED_SPORADIC, the result is implementa‐
87       tion-defined; this case includes the SCHED_OTHER policy.
88
89       The effect of this function on individual threads is dependent  on  the
90       scheduling contention scope of the threads:
91
92        * For threads with system scheduling contention scope, these functions
93          shall have no effect on their scheduling.
94
95        * For threads with process scheduling contention scope,  the  threads'
96          scheduling parameters shall not be affected. However, the scheduling
97          of these threads with respect to threads in other processes  may  be
98          dependent  on  the scheduling parameters of their process, which are
99          governed using these functions.
100
101       If an implementation supports a two-level  scheduling  model  in  which
102       library  threads  are  multiplexed  on  top of several kernel-scheduled
103       entities, then the underlying kernel-scheduled entities for the  system
104       contention scope threads shall not be affected by these functions.
105
106       The  underlying  kernel-scheduled  entities  for the process contention
107       scope threads shall have their scheduling  parameters  changed  to  the
108       value  specified in param. Kernel-scheduled entities for use by process
109       contention scope threads that are created  after  this  call  completes
110       shall inherit their scheduling policy and associated scheduling parame‐
111       ters from the process.
112
113       This function is not atomic  with  respect  to  other  threads  in  the
114       process.   Threads  may continue to execute while this function call is
115       in the process of changing the scheduling  policy  for  the  underlying
116       kernel-scheduled entities used by the process contention scope threads.
117

RETURN VALUE

119       If successful, the sched_setparam() function shall return zero.
120
121       If  the  call  to  sched_setparam() is unsuccessful, the priority shall
122       remain unchanged, and the function shall return a value of -1  and  set
123       errno to indicate the error.
124

ERRORS

126       The sched_setparam() function shall fail if:
127
128       EINVAL One  or  more  of the requested scheduling parameters is outside
129              the range defined for the scheduling  policy  of  the  specified
130              pid.
131
132       EPERM  The  requesting  process  does  not  have  permission to set the
133              scheduling parameters for the specified  process,  or  does  not
134              have the appropriate privilege to invoke sched_setparam().
135
136       ESRCH  No process can be found corresponding to that specified by pid.
137
138
139       The following sections are informative.
140

EXAMPLES

142       None.
143

APPLICATION USAGE

145       None.
146

RATIONALE

148       None.
149

FUTURE DIRECTIONS

151       None.
152

SEE ALSO

154       sched_getparam(),  sched_getscheduler(), sched_setscheduler(), the Base
155       Definitions volume of IEEE Std 1003.1-2001, <sched.h>
156
158       Portions of this text are reprinted and reproduced in  electronic  form
159       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
160       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
161       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
162       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
163       event of any discrepancy between this version and the original IEEE and
164       The Open Group Standard, the original IEEE and The Open Group  Standard
165       is  the  referee document. The original Standard can be obtained online
166       at http://www.opengroup.org/unix/online.html .
167
168
169
170IEEE/The Open Group                  2003                   SCHED_SETPARAM(3P)
Impressum