Several Linux I/O schedulers have been proposed. Some of these are:
- Completely Fair Queuing (CFQ)
CFQ is one of the input/output scheduler for the Linux kernel and is the current default scheduler in the Linux kernel.
What is kernel ?
Kernel is the central part of an operating system. It manages the operation between the hardware and the software. Every operating system has a kernel, for example the Linux kernel.
Completely Fair Queuing (CFQ) scheduler:
The Completely Fair Queuing (CFQ) scheduler is the I/O scheduler. The CFQ scheduler maintains a scalable per-process requests submitted by the processes into the number of per-process I/O queue and then allocate time for each of the queues to access the resource. This is done on the basis of the I/O priority of the given process.
In case of asynchronous requests, all the requests from all the processes are batched together into fewer queues according to their process’s I/O priority.
The CFQ scheduler divides the processes into 3 separates class:
- Real time (highest priority)
- Best effort
- Idle (lowest priority)
The real-time and best-effort scheduling classes are further subdivided into eight-eight I/O priorities.These priorities are 0 to 7. Zero(0) being the highest and 7 the lowest and 4 is the default priority within the class.
Process in the real time class are always performed before processes in best effort class, which is always performed before processes in the idle class. This means that due to the higher priority of the real time class, rest both class have to starve of the processor time. Processes are assigned to the best effort class by default.
When there is no other I/O pending in the system then the idle scheduling class are only serviced. Thus, it is very important to only set the I/O scheduling class of a process to idle if I/O from the process is not at all required for making further progress.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.