summary
There are four sched_class
,stop_sched_class --> rt_sched_class --> fair_sched_class --> idle_sched_class
They are linked one by one staticly by struct sched_class->next
by their defination.
Each sched_class
has method pick_next_task
, which is used to select
a perfect process to run from each sched_class
‘s runqueue.
When we need schedule, the four pick_next_task
will be called one by one.
As a optimization, most time there is no rt task in running state,
in this case we can directly call fair_sched_class
.
1 | 2322 /* |
question:
- how
stop_class
andidle_class
, they has no task? idle_task?
data structure
sched_class
1 | 1009 |
1 | 963 struct sched_class { |
stop_sched_class
1 | 102 /* |
rt_sched_class
1 | 1967 const struct sched_class rt_sched_class = { |
fair_sched_class
1 | 6170 /* |
idle_sched_class
1 | 87 /* |
pick_next_task
1 | 2313 /* |