Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scheduling policies in Linux Kernel

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 ?

like image 269
Sharat Chandra Avatar asked Dec 22 '22 00:12

Sharat Chandra


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.

like image 75
gby Avatar answered Dec 23 '22 14:12

gby


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 ... !!!

like image 37
RKT Avatar answered Dec 23 '22 14:12

RKT