Can there be more than two scheduling policies working at the same time in Linux Kernel ? Can FIFO and Round Robin be working on the same machine ?
2 Answers
Yes, Linux supports no less then 4 different scheduling methods for tasks: SCHED_BATCH, SCHED_FAIR, SCHED_FIFO and SCHED_RR.
Regardless of scheduling method, all tasks also have a fixed hard priority (which is 0 for batch and fair and from 1- 99 for the RT schedulign methods of FIFO and RR). Tasks are first and foremost picked by priority - the highest priority wins.
However, with several tasks available for running with the same priority, that is where the scheduling method kicks in: A fair task will only run for its allotted weighted (with the weight coming from a soft priority called the task nice level) share of the CPU time with regard to other fair tasks, a FIFO task will run for a fixed time slice before yielding to another task (of the same priority - higher priority tasks always wins) and RR tasks will run till it blocks disregarding other tasks with the same priority.
Please note what I wrote above is accurate but not complete, because it does not take into account advance CPU reservation features, but it give the details about different scheduling method interact with each other.

- 14,900
- 40
- 57
-
So are there separate run-queues & wait-queues for each scheduling policy ? – Sharat Chandra Mar 20 '12 at 16:23
-
There are different run queues for different scheduling policy families: a RT run queue (RR and FIFO) and a fair run queue (nice level and batch). AFAIK, wait queues are per object you are waiting on and is not related to the scheduling policy. – gby Mar 21 '12 at 16:19
-
Yeah.. Wait queue is per device – Sharat Chandra Mar 21 '12 at 19:38
-
1Almost correct. RR has a fixed time slice and FIFO will run until yield or blocked. – ola1olsson Jan 11 '13 at 17:58
yes !! now a days we have different scheduling policies at different stages in OS .. Round robin is done generally before getting the core execution ... fifo is done, at start stage of new coming process ... !!!

- 187
- 1
- 9
-
1@chandra: you can have a look at mid term , long term schedulers.. they all live in same kernel. – RKT Mar 19 '12 at 18:10