rtsched.2 (2010 09)

r
rtsched(2) rtsched(2)
PRI_POSIX_TO_HPUX()
Convert POSIX priority to HP-UX
sched_setparam()
The
sched_setparam()
function sets the scheduling parameters of the process specified by pid to the
values specified by the sched_param structure pointed to by param . The value of the sched_priority
member in the param structure is any integer within the inclusive priority range for the current schedul-
ing policy of the process specified by pid .
Higher numerical values for the priority represent higher (stronger) priorities. Note that this is different
from the
SCHED_HPUX, SCHED_TIMESHARE
, SCHED_NOAGE, and SCHED_RTPRIO scheduling policies,
where higher numerical values represent lower (weaker) priorities. See the
PRI_HPUX_TO_POSIX()
and PRI_POSIX_TO_HPUX()
functions, and SCHED_RTPRIO, SCHED_NOAGE
, and SCHED_OTHER in
Scheduling Policies below.
If a process described by pid exists and if the calling process has permission, the scheduling parameters
are set for the process whose process ID is equal to pid .
If pid is zero, the 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 enti-
ties for use by process contention scope threads that are created after this call completes, inherit
their scheduling policy and associated scheduling parameters from the process.
For single threaded processes, the scheduling parameters of its thread are also changed.
The priority returned is the old priority of the target process, though individual threads or lightweight
processes may have a different value if some other interface is used to change an individual thread or
lightweight processes priority.
Only a user with the
OWNER privilege may change the scheduling parameters of another process.
The calling process must have the
RTSCHED privilege to successfully call sched_setparam()
.
The target process, whether it is running or not running, will resume execution after all other runnable
processes of equal or greater priority have been scheduled to run.
If the priority of any kernel schedulable entities (threads) in the process is changed and is set higher than
that of the lowest priority running thread, and if any of the modified threads is ready to run, then it will
preempt the lower-priority running thread. Similarly, if the process calling
sched_setparam() sets
its own priority lower than that of one or more other nonempty thread lists, then the thread that is the
head of the highest priority list will also preempt the calling thread. Thus, in either case, the originating
process may not receive notification of the completion of the requested priority change until the higher
priority thread has executed.
sched_getparam()
The
sched_getparam() function returns the scheduling parameters of a process specified by pid in
the sched_param structure pointed to by param.
If a process described by pid exists, the scheduling parameters are returned for the process whose process
ID is equal to pid.
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.
If pid is zero, the scheduling parameters are returned for the calling process.
sched_setscheduler()
The
sched_setscheduler() function sets the scheduling policy and scheduling parameters of the
process specified by pid to policy and the parameters specified in the sched_param structure pointed to by
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010