1PTHREAD_GETSCHEDPARAM(3P)  POSIX Programmer's Manual PTHREAD_GETSCHEDPARAM(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       pthread_getschedparam, pthread_setschedparam - dynamic thread  schedul‐
13       ing parameters access (REALTIME THREADS)
14

SYNOPSIS

16       #include <pthread.h>
17
18       int pthread_getschedparam(pthread_t thread, int *restrict policy,
19              struct sched_param *restrict param);
20       int pthread_setschedparam(pthread_t thread, int policy,
21              const struct sched_param *param);
22
23

DESCRIPTION

25       The   pthread_getschedparam()   and  pthread_setschedparam()  functions
26       shall, respectively, get and set the scheduling policy  and  parameters
27       of  individual  threads within a multi-threaded process to be retrieved
28       and set. For SCHED_FIFO and SCHED_RR, the only required member  of  the
29       sched_param  structure is the priority sched_priority. For SCHED_OTHER,
30       the affected scheduling parameters are implementation-defined.
31
32       The pthread_getschedparam() function shall retrieve the scheduling pol‐
33       icy  and  scheduling parameters for the thread whose thread ID is given
34       by thread and shall store those values in  policy  and  param,  respec‐
35       tively.  The priority value returned from pthread_getschedparam() shall
36       be the value specified  by  the  most  recent  pthread_setschedparam(),
37       pthread_setschedprio(),  or  pthread_create() call affecting the target
38       thread. It shall not reflect any temporary adjustments to its  priority
39       as  a  result  of  any  priority  inheritance or ceiling functions. The
40       pthread_setschedparam() function shall set the  scheduling  policy  and
41       associated  scheduling  parameters  for  the  thread whose thread ID is
42       given by thread to the policy and  associated  parameters  provided  in
43       policy and param, respectively.
44
45       The  policy  parameter  may  have the value SCHED_OTHER, SCHED_FIFO, or
46       SCHED_RR. The scheduling parameters  for  the  SCHED_OTHER  policy  are
47       implementation-defined. The SCHED_FIFO and SCHED_RR policies shall have
48       a single scheduling parameter, priority.
49
50       If _POSIX_THREAD_SPORADIC_SERVER is defined, then the  policy  argument
51       may   have  the  value  SCHED_SPORADIC,  with  the  exception  for  the
52       pthread_setschedparam() function that if the scheduling policy was  not
53       SCHED_SPORADIC  at  the  time of the call, it is implementation-defined
54       whether the function is supported; in other words,  the  implementation
55       need  not  allow  the  application to dynamically change the scheduling
56       policy to SCHED_SPORADIC. The sporadic server scheduling policy has the
57       associated   parameters   sched_ss_low_priority,  sched_ss_repl_period,
58       sched_ss_init_budget, sched_priority, and sched_ss_max_repl. The speci‐
59       fied  sched_ss_repl_period shall be greater than or equal to the speci‐
60       fied sched_ss_init_budget for the function to succeed; if  it  is  not,
61       then  the  function shall fail. The value of sched_ss_max_repl shall be
62       within the inclusive range [1, {SS_REPL_MAX}] for the function to  suc‐
63       ceed; if not, the function shall fail.
64
65       If  the  pthread_setschedparam() function fails, the scheduling parame‐
66       ters shall not be changed for the target thread.
67

RETURN VALUE

69       If successful, the pthread_getschedparam() and  pthread_setschedparam()
70       functions  shall  return  zero;  otherwise,  an  error  number shall be
71       returned to indicate the error.
72

ERRORS

74       The pthread_getschedparam() function may fail if:
75
76       ESRCH  The value specified by thread does  not  refer  to  an  existing
77              thread.
78
79
80       The pthread_setschedparam() function may fail if:
81
82       EINVAL The  value  specified by policy or one of the scheduling parame‐
83              ters associated with the scheduling policy policy is invalid.
84
85       ENOTSUP
86              An attempt was made to set the policy or  scheduling  parameters
87              to an unsupported value.
88
89       ENOTSUP
90              An  attempt was made to dynamically change the scheduling policy
91              to SCHED_SPORADIC, and the implementation does not support  this
92              change.
93
94       EPERM  The  caller  does  not  have  the  appropriate permission to set
95              either the scheduling parameters or the scheduling policy of the
96              specified thread.
97
98       EPERM  The  implementation does not allow the application to modify one
99              of the parameters to the value specified.
100
101       ESRCH  The value specified by thread  does  not  refer  to  a  existing
102              thread.
103
104
105       These functions shall not return an error code of [EINTR].
106
107       The following sections are informative.
108

EXAMPLES

110       None.
111

APPLICATION USAGE

113       None.
114

RATIONALE

116       None.
117

FUTURE DIRECTIONS

119       None.
120

SEE ALSO

122       pthread_setschedprio(),   sched_getparam(),  sched_getscheduler(),  the
123       Base Definitions volume of IEEE Std 1003.1-2001, <pthread.h>, <sched.h>
124
126       Portions of this text are reprinted and reproduced in  electronic  form
127       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
128       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
129       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
130       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
131       event of any discrepancy between this version and the original IEEE and
132       The Open Group Standard, the original IEEE and The Open Group  Standard
133       is  the  referee document. The original Standard can be obtained online
134       at http://www.opengroup.org/unix/online.html .
135
136
137
138IEEE/The Open Group                  2003            PTHREAD_GETSCHEDPARAM(3P)
Impressum