1SCHED_SETSCHEDULER(3P)     POSIX Programmer's Manual    SCHED_SETSCHEDULER(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_setscheduler - set scheduling policy and parameters (REALTIME)
13

SYNOPSIS

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

DESCRIPTION

22       The sched_setscheduler() function shall set the scheduling  policy  and
23       scheduling parameters of the process specified by pid to policy and the
24       parameters specified in the sched_param structure pointed to by  param,
25       respectively. The value of the sched_priority member in the sched_param
26       structure shall be any integer within the inclusive priority range  for
27       the scheduling policy specified by policy.  If the value of pid is neg‐
28       ative, the behavior of the sched_setscheduler()  function  is  unspeci‐
29       fied.
30
31       The  possible  values  for  the  policy  parameter  are  defined in the
32       <sched.h> header.
33
34       If a process specified by pid exists, and if the  calling  process  has
35       permission,  the  scheduling  policy and scheduling parameters shall be
36       set for the process whose process ID is equal to pid.
37
38       If pid is zero, the scheduling policy and scheduling  parameters  shall
39       be set for the calling process.
40
41       The conditions under which one process has the appropriate privilege to
42       change the scheduling parameters of another process are implementation-
43       defined.
44
45       Implementations may require that the requesting process have permission
46       to set its own scheduling parameters or those of another process. Addi‐
47       tionally,  implementation-defined  restrictions  may  apply  as  to the
48       appropriate privileges required to set a process' own  scheduling  pol‐
49       icy, or another process' scheduling policy, to a particular value.
50
51       The  sched_setscheduler() function shall be considered successful if it
52       succeeds in setting the scheduling policy and scheduling parameters  of
53       the  process specified by pid to the values specified by policy and the
54       structure pointed to by param, respectively.
55
56       If the scheduling policy specified by  policy  is  SCHED_SPORADIC,  the
57       value  specified by the sched_ss_low_priority member of the param argu‐
58       ment shall be any integer within the inclusive priority range  for  the
59       sporadic server policy. The sched_ss_repl_period and sched_ss_init_bud‐
60       get members of the param argument shall represent the  time  parameters
61       used  by  the sporadic server scheduling policy for the target process.
62       The sched_ss_max_repl member of the param argument shall represent  the
63       maximum  number of replenishments that are allowed to be pending simul‐
64       taneously for the process scheduled under this scheduling policy.
65
66       The specified sched_ss_repl_period shall be greater than  or  equal  to
67       the  specified  sched_ss_init_budget for the function to succeed; if it
68       is not, then the function shall fail.
69
70       The value of sched_ss_max_repl shall be within the inclusive range  [1,
71       {SS_REPL_MAX}]  for the function to succeed; if not, the function shall
72       fail.
73
74       If the scheduling policy specified by policy is  either  SCHED_FIFO  or
75       SCHED_RR,    the   sched_ss_low_priority,   sched_ss_repl_period,   and
76       sched_ss_init_budget members of the param argument shall have no effect
77       on the scheduling behavior.
78
79       The  effect  of this function on individual threads is dependent on the
80       scheduling contention scope of the threads:
81
82        * For threads with system scheduling contention scope, these functions
83          shall have no effect on their scheduling.
84
85        * For  threads  with process scheduling contention scope, the threads'
86          scheduling policy and associated parameters shall not  be  affected.
87          However,  the scheduling of these threads with respect to threads in
88          other processes may be dependent on  the  scheduling  parameters  of
89          their process, which are governed using these functions.
90
91       If  an  implementation  supports  a two-level scheduling model in which
92       library threads are multiplexed  on  top  of  several  kernel-scheduled
93       entities,  then the underlying kernel-scheduled entities for the system
94       contention scope threads shall not be affected by these functions.
95
96       The underlying kernel-scheduled entities  for  the  process  contention
97       scope  threads shall have their scheduling policy and associated sched‐
98       uling parameters changed to the values specified in policy  and  param,
99       respectively.  Kernel-scheduled  entities for use by process contention
100       scope threads that are created after this call completes shall  inherit
101       their  scheduling  policy and associated scheduling parameters from the
102       process.
103
104       This function is not atomic  with  respect  to  other  threads  in  the
105       process.   Threads  may continue to execute while this function call is
106       in the process of changing the scheduling policy and associated  sched‐
107       uling  parameters  for the underlying kernel-scheduled entities used by
108       the process contention scope threads.
109

RETURN VALUE

111       Upon successful completion, the function shall return the former sched‐
112       uling  policy  of  the  specified  process. If the sched_setscheduler()
113       function fails to complete  successfully,  the  policy  and  scheduling
114       parameters  shall  remain  unchanged,  and  the function shall return a
115       value of -1 and set errno to indicate the error.
116

ERRORS

118       The sched_setscheduler() function shall fail if:
119
120       EINVAL The value of the policy parameter is invalid, or one or more  of
121              the parameters contained in param is outside the valid range for
122              the specified scheduling policy.
123
124       EPERM  The requesting process does not have permission to set either or
125              both  of  the  scheduling parameters or the scheduling policy of
126              the specified process.
127
128       ESRCH  No process can be found corresponding to that specified by pid.
129
130
131       The following sections are informative.
132

EXAMPLES

134       None.
135

APPLICATION USAGE

137       None.
138

RATIONALE

140       None.
141

FUTURE DIRECTIONS

143       None.
144

SEE ALSO

146       sched_getparam(), sched_getscheduler(), sched_setparam(), the Base Def‐
147       initions volume of IEEE Std 1003.1-2001, <sched.h>
148
150       Portions  of  this text are reprinted and reproduced in electronic form
151       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
152       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
153       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
154       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
155       event of any discrepancy between this version and the original IEEE and
156       The  Open Group Standard, the original IEEE and The Open Group Standard
157       is the referee document. The original Standard can be  obtained  online
158       at http://www.opengroup.org/unix/online.html .
159
160
161
162IEEE/The Open Group                  2003               SCHED_SETSCHEDULER(3P)
Impressum