on my 2.6.8.1 system there is one runqueue for each CPU
Each runqueue contains two priority arrays active and expired and a data structure for info about the threads.
When a task runs out of timeslice, it is removed from the active priority
array and put into the expired priority array and new timeslices are recalculated individually then. when the active array is empty the pointer to the two arrays is switched.
Priority arrays are an array of linked lists, one for each 140 priority levels.
if multiple tasks exit at the same priority level, they are scheduled
round-robin against each other.after running, tasks are put at the bottom of their priority level’s list.
RT tasks have priorities from 0 to 99 while non-RT task priorities map onto 100+
RT tasks operate like you said under these two different scheduling schemes.
non-RT tasks are SCHED_NORMAL
SCHED_FIFO is the strongest of all RT task -- it has no timeslice and higher priority SCHED_FIFO tasks will preempt lower. SCHED_FIFO tasks are not preemptable by anything else. They just run. firt in first out.
SCHED_RR (round robin) within a certain priority range they are scheduled using round robin. they have a timeslices and are always preempted by SCHED_FIFO. when their timeslice is done they go to the bottom of their priority array.
Quote:
how are these policies assigned to the processes?
|
well you define a RT_TASK structure
fifo is created with rtf_create() rtf_create_handler() rtf_get()
and like that
FIFO really is a pipe to a /dev/rtf0 and like that
otherwise i think it's scheduled RR