A Comparison of I/O Schedulers
Mulyadi Santosa and Fawad Lateef
What do you think of when you read the term "scheduler"? If you think of the mechanism that schedules the order in which processes are served, then you already have an idea of what this article is about. The term "scheduler" itself is broad, and in this article we will narrow it down to I/O, specifically disk I/O.
The first question to consider is why you need an I/O scheduler. To answer that, let's briefly see how a disk (ATA/SATA HDD or "hard disk drive") works. A typical HDD provides two ways of accessing a specific location:
- C/H/S (Cylinder/Head/Sector)
- LBA (Logical Block Address)
Most operating systems use LBA (especially Linux), which is based on sectors only, so the OS doesn't need to take into account cylinders and heads (each sector has a size of 512 bytes). When the OS asks a sector to be read, the disk head moves to the target sector, stops, fetches the content, puts it in disk's buffer, and generates an interrupt. This process is the same for all disk access whether it's for reading or writing. Note that the head moves mechanically, unlike the RAM/Memory, which has hardwired addresses and is directly accessible by the processor. So accessing a sector on disk can be hundreds or thousands of times slower than RAM access, and the seeking latency for a specific sector can vary greatly.
Also, the mechanical nature of disk head movement causes another issue: More time spent moving the head means longer actual access time. It's preferable if all the data can be read with just one sweep, but of course that's an ideal case.
So, given these large variations in seeking time, what can be done to decrease read/write latency? This is the question the I/O scheduler tries to solve.
|