Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scheduling algorithms in linux kernel

How many different algorithms are implemented in the linux kernel? Are there only FIFO and Round Robin, or are there any other?

Where can I found a good documentation on this topic?

Let's say if I wanted to implement these algorithms myslef, where should I start?

like image 321
Kajzer Avatar asked Feb 20 '23 11:02

Kajzer


1 Answers

In terms of real-time schedulers, linux provides FIFO and Round-Robin (POSIX SCHED_FIFO and SCHED_RR). There is also a time-sharing scheduler called the Completely Fair Scheduler (CFS), which is complex enough that you might call it multiple schedulers (i.e., multi-core, and several styles/flavors of preemption for different loads). CFS is described in some detail in the kernel documentation (sched-design-CFS) but a careful read of the relevant sources is recommended. CFS is linux's implementation of POSIX's SCHED_OTHER policy.

Additionally, there are patches that add other scheduling policies like a new real-time Earliest Deadline First (EDF) scheduler.

Apart from a number of books on the topic, many of which are immediately out of date at publication time, you can refer to the kernel documentation here or in your kernel tree under docs/scheduler. It's also useful to peruse the LKML archives for discussion on the topic.

If you are just getting started or want to play with a wider range of real-time schedulers, you might consider UNC's LITMUS-RT framework.

like image 147
andersoj Avatar answered Feb 28 '23 02:02

andersoj