HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
r
rtsched(2) rtsched(2)
Each process will be controlled by an associated scheduling policy and priority. These parameters may be
specified by explicit application execution of the sched_setscheduler() or sched_setparam()
functions.
Associated with each policy is a priority range. The priority ranges for each policy can (but need not) over-
lap the priority ranges of other policies.
When a process is to be selected to run, the process that is at the head of the highest priority nonempty
process list is chosen. It is then removed from its process list.
The following scheduling policies are defined:
SCHED_FIFO First in-first out (FIFO) scheduling policy.
Processes scheduled under this policy are chosen from a process list that is ordered by
the time its processes have been in the list without being executed. Generally, the
head of the list is the process that has been in the list the longest time, and the tail is
the process that has been in the list the shortest time.
Under the SCHED_FIFO policy, the modification of the definitional process lists is as
follows:
When a running process becomes a preempted process, it becomes the head of
the process list for its priority.
When a blocked process becomes a runnable process, it becomes the tail of the
process list for its priority.
When a running process calls the sched_setscheduler()
function, the
process specified in the function call is modified to the policy and priority
specified by the param argument. If the process whose policy and priority
has been modified is a running process or is runnable, it then becomes the tail
of the process list for its new priority.
When a running process calls the
sched_setparam()
function, the prior-
ity of the process specified in the function call is modified to the priority
specified by the param argument. If the process whose priority has been
modified is a running process or is runnable, it then becomes the tail of the
process list for its new priority.
When a running process issues the
sched_yield()
function, the process
becomes the tail of the process list for its priority.
At no other time is the position of a process with this scheduling policy within
the process lists affected.
For this policy, valid priorities are within the range returned by the functions
sched_get_priority_max() and sched_get_priority_min() when
SCHED_FIFO is provided as the parameter. The priority range for this policy con-
tains at least 32 priorities.
SCHED_RR Round-robin scheduling policy, with a per-system time slice (time quantum).
This policy is identical to the SCHED_FIFO policy with the additional condition that
when the implementation detects that a running process has been executing as a run-
ning process for a time period of length returned by the function
sched_rr_get_interval()
, or longer, the process becomes the tail of its pro-
cess list, and the head of that process list is removed and made a running process.
The effect of this policy is to ensure that if there are multiple
SCHED_RR processes at
the same priority, one of them will not monopolize the processor. An application
should not rely only on the use of SCHED_RR to ensure application progress among
multiple processes if the application includes processes using the SCHED_FIFO policy
at the same or higher priority levels, or SCHED_RR processes at a higher priority
level.
A process under this policy that is preempted and subsequently resumes execution as
a running process completes the unexpired portion of its round-robin interval time
period.
Section 2268 4 HP-UX Release 11i: December 2000
___
___