ArticleslgStudy

computer science

Completely fair queueing

Completely fair queueing is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Completely fair queueing rather than just read about it. In short: Completely Fair Queuing (CFQ) is an I/O scheduler for the Linux kernel which was written in 2003 by Jens Axboe. Description CFQ places synchronous requests submitted by processes into a number of per-process queues and then allocates timeslices for each of the queues to access the disk.

Key takeaways

  • Completely fair queueing belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Completely fair queueing to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Completely fair queueing from memory before moving on to harder problems.

Reference excerpt

Completely Fair Queuing (CFQ) is an I/O scheduler for the Linux kernel which was written in 2003 by Jens Axboe.

Description CFQ places synchronous requests submitted by processes into a number of per-process queues and then allocates timeslices for each of the queues to access the disk. The length of the time slice and the number of requests a queue is allowed to submit depends on the I/O priority of the given process. Asynchronous requests for all processes are batched together in fewer queues, one per priority. While CFQ does not do explicit anticipatory I/O scheduling, it achieves the same effect of having good aggregate throughput for the system as a whole, by allowing a process queue to idle at the end of synchronous I/O thereby "anticipating" further close I/O from that process. It can be considered a natural extension of granting I/O time slices to a process.

History

Prior to the integration In February 2003 Andrea Arcangeli put forward his idea for a Stochastic Fair Queueing I/O scheduler to Jens Axboe who then implemented it. Jens Axboe made improvements to his first implementation, calling the new version the Completely Fair Queueing scheduler, and produced a patch to apply it to the 2.5.60 development series kernel.

Kernel 2.6.6 (10 May 2004) The CFQ I/O scheduler was first integrated into the mainline kernel as an optional I/O scheduler. It was possible to change the scheduler at boot time with the 'elevator' parameter to kernel.

Kernel 2.6.9 (19 October 2004) Red Hat Enterprise Linux 4 used this I/O scheduler as the default even though it used a kernel based on a 2.6.9.

Kernel 2.6.10 (24 December 2004) The second release of the CFQ scheduler dubbed CFQv2 is included in the 2.6.10, improvements include better responsiveness and the elimination of some starvation issues which were present in the earlier version. The scheduler now is also switchable at run time by modifying the /sys/block/<block_device>/queue/scheduler variable in the sysfs filesystem.

Kernel 2.6.13 (27 June 2005) CFQ scheduler moved to a new time sliced design dubbed CFQv3. Among other things, it implements ioprio_get(2) and ioprio_set(2) which allows user to set per-process I/O priorities, usually using ionice(1) command (although using nice(1) also modifies I/O priorities somewhat).

Kernel 2.6.18 (20 September 2006) CFQ became the default scheduler, replacing the anticipatory scheduler.

Kernel 5.0 (3 March 2019) CFQ has been removed. CFQ evolved into Budget Fair Queueing (BFQ).

See also Noop scheduler Deadline scheduler Anticipatory scheduling

References

Sources Short detail about CFQ (archived from here) Coming in 2.6.10

External links Documentation of CFQ from the Linux source code CFQ - Tuning guide from RedHat's knowledge base

Worked examples

Example 1 — a first encounter with Completely fair queueing

Start with the simplest possible case. Write down what Completely fair queueing claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Completely fair queueing before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Completely fair queueing ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Completely fair queueing

In research
Completely fair queueing appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Completely fair queueing in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Completely fair queueing is common in secondary-school and first-year university syllabi. It links to neighbouring topics Disk scheduling algorithms, Linux kernel features, Scheduling algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Completely fair queueing outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Completely fair queueing” →

How to study Completely fair queueing in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Completely fair queueing means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Completely fair queueing out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Completely fair queueing in simple terms?

Completely Fair Queuing (CFQ) is an I/O scheduler for the Linux kernel which was written in 2003 by Jens Axboe. Description CFQ places synchronous requests submitted by processes into a number of per-process queues and then allocates timeslices for each of the queues to access the disk.

Why does Completely fair queueing matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Completely fair queueing?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Completely fair queueing.

Tags

  • Disk scheduling algorithms
  • Linux kernel features
  • Scheduling algorithms

Keep exploring