HP-UX Reference (11i v2 04/09) - 2 System Calls (vol 5)
r
rtsched(2) rtsched(2)
The possible values for the policy parameter are defined in the header file
<sched.h>, and mentioned
below.
If a process described by pid exists, the scheduling policy and scheduling parameters are set for the pro-
cess whose process ID is equal to pid .
If pid is zero, the scheduling policy and scheduling parameters are set for the calling process.
If the process pid contains more than one thread or lightweight process (that is, the process is mul-
tithreaded), this function will affect the policy and priority of individual kernel schedulable entities in the
process depending on their scheduling contention scope.
• For threads created with system contention scope, this system call will have no effect on their
scheduling or the scheduling of the underlying kernel scheduled entities.
• For threads with process contention scope, the threads’ scheduling parameters will not be
affected. However, the underlying kernel scheduled entities for the process contention scope
threads will have their scheduling parameters changed to the value specified in param. Kernel
scheduled entities for use by process contention scope threads that are created after this call
completes, inherit their scheduling policy and associated scheduling parameters from the pro-
cess.
The priority returned is the old priority of the target process, though an individual thread or lightweight
process may have a different value if some other interface is used to change individual thread’s or light-
weight process’s priority.
Appropriate privileges are required to change the scheduling parameters of another process.
The calling process must have appropriate privileges or be a member of a group having
PRIV_RTSCHED
access to successfully call sched_setscheduler()
.
The
sched_setscheduler()
function is considered successful if it succeeds in setting the scheduling
policy and scheduling parameters of the process specified by pid to the values specified by policy and the
structure param , respectively.
sched_getscheduler()
The
sched_getscheduler()
function returns the scheduling policy of the process specified by pid.
The values that can be returned by
sched_getscheduler()
are defined in the header file
<sched.h> (see sched_setscheduler()
).
If a process described by pid exists, the scheduling policy is returned for the process whose process ID is
equal to pid.
If pid is zero, the scheduling policy is returned for the calling process.
If the process pid contains more than one thread or lightweight process (that is, the process is mul-
tithreaded), this function shall only return the process scheduling policy and priority. Individual threads
or lightweight processes in the target process will have their own scheduling policies and priorities which
may be different from the scheduling policy and priority of their process.
sched_yield()
The
sched_yield() function forces the calling thread to relinquish the processor until it again
becomes the head of its thread list. It takes no arguments.
sched_get_priority_max()
sched_get_priority_min()
The
sched_get_priority_max() and sched_get_priority_min()
functions return the
appropriate maximum or minimum, respectively, for the scheduling policy specified by policy .
The value of policy must be one of the scheduling policy values defined in
<sched.h>.
sched_rr_get_interval()
The
sched_rr_get_interval() function updates the timespec structure referenced by the interval
argument to contain the current execution time limit (that is, time quantum) for the process indicated by
pid under the SCHED_RR policy, at which a scheduling decision will be made when another process at
the same priority is ready to execute. If pid is zero, the current execution time limit for the calling pro-
cess is returned.
HP-UX 11i Version 2: September 2004 − 3 − Hewlett-Packard Company Section 2−−297