How CFS is run on Linux and how it is the preferred way for running a CPU efficiently [Summary].
CFS [ completely fair scheduling ] become part of Linux kernel in 2007 (Kalin, 2019). Its main aim is ensure `fair` and effective resource distribution and sharing among process running in the system.
How it works:
By virtue of being fair, it means that resources are equally distributed to the processes that are running. Take for example 2 processes that need to use the CPU. CFS sort of divides the CPU in half giving 50% to each of the individual processes.
CFS does not use the FIFO principle like preemptive scheduling; it implements complex data structures such as the "time-ordered red-black tree as a runqueue" (Kalin, 2019). Data structures are organized into hierarchies based on a certain property (Kalin, 2019).
This tree data structure represents a task execution timeline, with 3 internal node's for the scheduled tasks (Kalin, 2019). In this tree structure, tasks that 'urgently' need the processor are kept on the left side of the tree while other tasks are on the right side of the tree (Kalin, 2019).
Why its the preferred way of running CPU efficiently
The CPU is well utilized and idle time minimized using CFS. Resources are also distributed fairly and efficiently among the running jobs.?
CFS is also efficient as it does away with the orthodox time slicing and priority scheduling concepts.
References
Kalin,?M. (2019, February 5).?CFS: Completely fair process scheduling in linux. Opensource.com.?https://opensource.com/article/19/2/fair-scheduling-linux