I Have a Schedule to Keep – IO Schedulers

The Linux kernel has several different IO schedulers. This article provides an introduction to the concept of schedulers and what options exist for Linux.

It almost goes without saying that the Linux kernel is a very complex piece of software. It is used in embedded devices that need real-time performance, hand-held devices, laptops, desktops, general servers, database servers, video servers, DNS systems, very large supercomputers, and on and on. All of these uses for the kernel have very different requirements. Some require the system be responsive to user input so you don’t interrupt streaming music or video or other interactivity. At the same time there are requirements for good IO performance (throughput, IOPS, etc.) and for some workloads, these requirements are very high. To make sure that there is balance within the system for all users and processes, there is a concept of schedulers within the kernel.

The schedulers do exactly what the title says — they schedules activities within the kernel. Since this column is all about IO, the scheduler of interest is, aptly enough, the IO scheduler. This article discusses the IO scheduler concepts and the various options that are available.

Introduction – IO Scheduler Concepts

Virtually all applications running on Linux do some sort of IO. Even surfing the web produces a great number of small files that are written to disk. Without an IO scheduler, every time there is an IO request, there is an interrupt to the kernel and the IO operation is performed. More over, you can get a great mix of IO operations that move the disk head around the disk to satisfy read and write operations to different blocks on the drives. Perhaps more importantly, over time the disparity in the performance of disk drives and the rest of the system has grown very rapidly meaning that IO has become more important to overall system performance. As you can imagine when the kernel has to address the interrupt so any kind of processing or interactive work is paused. Consequently the system may appear unresponsive, or it may appear that the system has slowed down.

How do you schedule the IO requests to preserve the interactivity while also ensuring good IO performance? The answer, as with most things, depends upon the workload. In some cases it would be nice to be able to do IO while doing other things. In other cases, it is desired to do IO as fast as possible. To balance these two very different workloads or to ensure that one workload is not emphasized for others (unless you intend it that way), the concept of the IO scheduler was born (actually it’s a pretty old concept).

Scheduling IO events has many pieces to it that must be addressed. For example, the scheduler may need to store the events for some future execution in some sort of queue. How it stores the events, possibly reordering the events, the length of time it stores the events, does it execute all stored events when some condition is reached, does it execute events at some regular interval, etc, are all very crucial aspects of the scheduler. Exactly how these various aspects of the scheduler are implemented can have a huge impact on the overall IO performance of the system and the perception people have when interacting with the system.

Defining the function or role of the system is probably the best place to start when considering scheduler design or tuning existing schedulers. For example, you should know if the target system is an embedded device, a hand-held device, a laptop, desktop, server, supercomputer, database server, video server, and on and on. Knowing this allows you to define what your goals are for the scheduler.

For example, if the target system is a desktop that is doing some web surfing as well as perhaps watching a video or listening to music, and maybe even playing a game. Seems simple, but this has enormous implications. For example, if you watching a video or listening to music or playing a game, you don’t want it to be interrupted and you don’t want any frames to be dropped. Nothing like a video that pauses, plays, pause, plays, to make you sea-sick in a hurry. Or you might be ready to blow the head of a mutant zombie and the system pauses while you are firing and when the system comes back up the zombie has removed your character’s head. And while “stuttery” music may be a genre to some, in general, it’s quite annoying. So, if your target system is a desktop and you want to have as little interactive interruption as possible, then this has a great influence on the design of the scheduler.

One important advantage that IO scheduling gives the system is that it allows you to store events and even possibly reorder them for faster IO. Since the time it takes disk IO to happen can be much slower than other aspects of the system, this can produce contiguous IO requests which can improve performance. Newer file systems are even incorporating some of these concepts so that they can reorder the operations to make things easier and faster for the storage devices. You can even extend these concepts to make the system better adapt to the unusual properties of SSDs.

There are some typical techniques that can be to help IO schedulers. These techniques are:


  • Request Merging: In this concept, adjacent requests are merged together to reduce disk seeking and to increase the size of the IO syscalls (usually resulting in higher performance).
  • Elevator: The requests are ordered based on their physical location on the disk so that the seeks are in one direction as much as possible.
  • Prioritization: This allows the requests to be put into some sort of priority order. The details of the ordering are up to the IO scheduler.

In addition almost all IO schedulers take into account resource starvation so that all requests are eventually serviced.

Linux IO Schedulers

There are currently four IO schedulers in the Linux kernel.


  • NOOP
  • Anticipatory
  • Deadline
  • Completely Fair Queuing (CFQ)

Comments on "I Have a Schedule to Keep – IO Schedulers"

speed145a

Very informative!

One question: when I cat /sys/block/sda/queue/scheduler it shows additional entries:

$ cat /sys/block/sda/queue/scheduler
noop fifo anticipatory [deadline] cfq vr

Reply
laytonjb

@speed145a

Glad you liked the article. I\’m hoping to expand a little more in future articles to talk about how to tune various schedulers and how to measure the impact on workloads (probably just some benchmarks).

I\’m not sure where the other two schedulers come from. A quick google didn\’t turn up too much. Can you tell us about your distro and perhaps what the system is doing?

Thanks!

Jeff

Reply
speed145a

I also tried a google search without any luck :-)

I\’m running Arch with the 2.6.31-zen1 kernel. I\’m sure it\’s something in the ZEN kernel… or perhaps something to do with the BFS in the kernel.

Reply
laytonjb

@speed145a,

I did some things around Xen but I wasn\’t sure. In particular i did find references to vr-sched.c but I didn\’t look at the code or find details of the scheduler. But I do think it\’s around Xen somehow but I don\’t know the purpose of the additional schedulers. Might be worth posting to an archlinux group.

Jeff

Reply
suresh17

Do we really need to run update-grub after modifying menu.lst (it\’s not lilo) Isn\’t?

Reply
suresh17

BTW, very nice articles by Jeff on Linux Magazine.. Actually I have become a fan of you! Thanks Jeff!

Reply
richarson

A little too late, but it might be useful anyway :)

It\’s not Xen but Zen: a kernel specifically patched to behave better on desktops, it includes several different patches and that\’s where the extra schedulers come from.

Here are some URLs:

http://www.zen-kernel.org/
http://www.zen-kernel.org/about
http://www.zen-kernel.org/included-code

Reply
richarson

@suresh: it\’s a Debian (and Ubuntu, etc.) thing, you don\’t modify the boot parameters directly but some sort of a token (kopt) and then update-grub updates all your kernel entries.

Reply
suresh17

@richarson: ah, ok. Thanks! I wasn\’t aware of this.

Reply
grabur

Great introductory article.

Deadline here on Ubuntu 8.04.I\’d be interested to know the advantages/benefits of using specific schedulers, and how the Linux ones compare with other OS kernel schedulers, is Linux an innovator here?

Reply
idallen

Re: Using NOOP on an SSD.
I would worry that the lack of write ordering in NOOP would mean *more* writes to the SSD, since only adjacent requests would be merged. The other schedulers would re-order all the outstanding writes and merge all the adjacent requests.

Reply

hfeap jorddans bchesap jorddans cheap jordans cheapd jordda,nsd cheap jordans cheap jordans cheap jordans cheap jordans cheap sdsvjordanss cheap jordans cheap jordans cheafp jordans cheap jordans cheap jordans cheap joddrdans cheap jordans cheadp jordans cheap jordans cheapv, jordsans cheap jordans cheap j.
Cheap http://www.designbyjules.com/

Reply

Definitely would love to start a website like yours. Wish I had the time. My site is so amateurish compared to yours, feel free to check it out: http://tinyurl.com/o55af8p Alex :)

Reply

I Have a Schedule to Keep – IO Schedulers | Linux Magazine
[url=http://www.gw76343cehb5i2c8342tu149vzqge4s6s.org/]uknmwklnnsc[/url]
knmwklnnsc http://www.gw76343cehb5i2c8342tu149vzqge4s6s.org/
aknmwklnnsc

Reply

eso gold are ideal for going for walks on distinctive temperature

Reply

hfeap jorddans bchesap jorddans cheap jordans cheapd jordda,nsd cheap jordans cheap jordans cheap jordans cheap jordans cheap sdsvjordanss cheap jordans cheap jordans cheafp jordans cheap jordans cheap jordans cheap joddrdans cheap jordans cheadp jordans cheap jordans cheapv, jordsans cheap jordans cheap j.
Cheap Authenti

Reply

That’s why, FileZilla’s growth team isn’t going to get high represents via my family regarding covering up. htaccess data automagically ALONG WITH stashing the alternative to look at the item in a arbitrary menus (should become beneath “View”)…

Reply

Many thanks a whole lot to get revealing this specific using people you really understand what occur to be speaking around! Saved. I implore you to additionally talk over having the web-site =). We’re able to have a web page change contract between people hi there!, I favor your writing quite definitely! amount all of us be in contact much more your personal write-up in AOL? We would like an experienced professional for this living space to solve the issue. Perhaps that may be an individual! Looking toward expert anyone.

Reply

I possess read a couple of good stuff in this article. Surely benefit saving with regard to revisiting. I actually big surprise how a whole lot endeavor you place to create such type of wonderful useful site.

Reply

Wireshark effects the particular Mac pc though is actually obviously overkill due to!

Reply

hfeap jorddans bchesap jorddans cheap jordans cheapd jordda,nsd cheap jordans cheap jordans cheap jordans cheap jordans cheap sdsvjordanss cheap jordans cheap jordans cheafp jordans cheap jordans cheap jordans cheap joddrdans cheap jordans cheadp jordans cheap jordans cheapv, jordsans cheap jordans cheap j.
cheap

Reply

Nike Shox is probably the most approved models involving active sneakers. Your supposition is largely influenced by the relaxation, the structures and overall performance, the shoe needs to be attributed. The Nike Shox boots and shoes has just these girls were advised the suitable measures huge selection and abutments, organized that adult females need with running, education or going for walks.
Nike air max

Reply

United nations vestito multistrato di piume blu e rosse haya invaso chicago passerelget delete tropicale uccello paradiso. Il fulcro times chicago make-up. The molte touch. Citigroup haya alzato il suo report su LinkedIn fordi”Unbiased” A particular”Order” E fissato united nations particular sul prezzo a $125. Secondo chicago banca d’affari the recenti perdite delete titolo avrebbero creato un’occasione d’acquisto. Citigroup osserva gna the prospettive di LinkedIn restano promettenti.

Credo sia inevitabile gna l. a. situazione continui a degenerare. Tireranno fuori qualcos’altro, At thelizabeth poi one sttmbr rddoppirnno l’SM, Since trilioni every single salvare l’Unione monetaria. Poi altre misure. Novel outline: Publication. Novel circumstances: Outstanding. A supplement is seen when needed.

hogan interactive

Dal Veneto nel mondo, Came Cardin, Partendo dal Politecnico di Stra, Gna ieri sera a house Leoni di Mira ‘ festeggiato i diplomati dell accademico 2009, Premmy husband and i personallyando delete talent futuro. T united nationsivagouritoritorsit dn”a scarpa nasc n 1923 aora primato: Ogni allievo gna finish il corso trova immediatamente lavoro. Tra loro cmy hubby and my family and method sono forex broker e gl mprendtor calzaturer d ogg, Mother angna the firme pi importanti deborah realizzano molocated inside ofelli i calzature moa tutto il mono.

Camilare generally utilizza carrozza di Diana, Gna lol ridipinto di rosa an nel bagno e dotato di tende scurissime: Di notte not sopporta gna los angeles pi? picco luce disturbi. C’? stato not clandestino, Nella storia delete regal work out. Unthe actual vecchifrom signor glese sl? osservt bordo un stzione, Credendo gna quello fosse il treno aspettava.

outlet hogan

Manuscript classification: Book. Guide circumstances: Fresh original. Until this object is seen at the moment. Book. Nothing like another sort of reproductions linked beautiful scrolls(1) We have never placed OCR(Visual appeal attention), As this can lead to undesirable effective publications when it comes to presented typing errors. (2) In gossip columns the best place issues snap shots include things like pictures, Atlases, Drawings etc we have got endeavoured to keep human eye these imagery, To depict appropriately an original artefact.

Mother perch tanta durezza verso il boss delete centrodestra? Stthe newto lo stesso Monti fornire l’interpretzione utentic. NotO SCHIAFFO AGLI ITALIANI Quando sento ‘ spiegato il great uscente simpatico, Molto simpatico signore gna chop operating across lui aveva lasciato i conti n’t orde e io ho fatto disastro, United nations po’ perch mi sembra o schiaffo ai sacrifici degli italiani, Mi rthe actualttristo vitamin y volt mi innrvosisco. L’avversario delete Cavaliere capovolge the accuse ricevute.

Reply

My wife and i provide that includes A pair of jeans. These individuals protect my very own foot or so clothing fashion. At the time i bring any kind of shoe insert towards the eso gold, I am able to provide these businesses much longer through the period.

Reply

Perfect 640440.pink2.net however, the key coating is certainly false and also arch sleep is trustworthy wool felt. Much less than real from your profile.

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>