What kind of scheduling algorithms are used in 15.04? Is it possible to change it?

Would like to know what scheduling mechanisms is employed in 15.04, time-sharing or real-time, I'm pretty sure its FIFO, Round Robin, SJF?

P.S: New to Linux


Solution 1:

Process scheduler

A process scheduler handles CPU resource allocation for executing processes, and aims to maximize overall CPU utilization while also maximizing interactive performance.

Since kernel 2.6.23 (that would be as of Hardy 8.04 LTS) Completely Fair Scheduler (CFS) based on "Rotating Staircase Deadline". Overview from kernel.org:

CFS stands for "Completely Fair Scheduler," and is the new "desktop" process scheduler implemented by Ingo Molnar and merged in Linux 2.6.23. It is the replacement for the previous vanilla scheduler's SCHED_OTHER interactivity code.

80% of CFS's design can be summed up in a single sentence: CFS basically models an "ideal, precise multi-tasking CPU" on real hardware.

"Ideal multi-tasking CPU" is a (non-existent :-)) CPU that has 100% physical power and which can run each task at precise equal speed, in parallel, each at 1/nr_running speed. For example: if there are 2 tasks running, then it runs each at 50% physical power --- i.e., actually in parallel.

On real hardware, we can run only a single task at once, so we have to introduce the concept of "virtual runtime." The virtual runtime of a task specifies when its next timeslice would start execution on the ideal multi-tasking CPU described above. In practice, the virtual runtime of a task is its actual runtime normalized to the total number of running tasks.


  • Kernel 2.4: O(n) scheduler; there is no Ubuntu release with that kernel.
  • Kernel 2.6.0 to 2.6.22: O(1) scheduler. Warty 4.10 (1st release) used 2.6.8. Gutsy 7.10 was the last one that used 2.6.22 or lower.

I/O scheduler

Input/output scheduling is the method that operating system uses to decide in which order block I/O operations will be submitted to storage volumes.

Phoronix article on scheduling: Linux 3.16: Deadline I/O Scheduler Generally Leads With A SSD.


You can change the I/O scheduler by appending the option "elevator=" to "GRUB_CMDLINE_LINUX_DEFAULT=" in grub.

  • for using Completely Fair Queuing that would be "elevator=cfq".
  • "elevator=deadline" for Deadline I/O
  • "elevator=noop" for Noop

It is probably easier (assuming sda and deadline) to do it like this though:

  • To show the list of available schedulers:

    cat /sys/block/sda/queue/scheduler
    
  • And to alter a scheduler (can be done on the fly):

    echo deadline > /sys/block/sda/queue/scheduler
    

From kernel/git/torvalds/linux.git


You can check what is being used with (assuming sda as primairy):

cat /sys/block/sda/queue/scheduler