I/O scheduler

Also known as: disk scheduler

On this page 7

An I/O scheduler, also called a disk scheduler, is the operating system component that decides in which order pending read and write requests are sent to a block device. In the area of Drivers & devices within operating systems, it sits between the file system and the device driver, where it can merge, reorder and delay requests to improve throughput, reduce latency or share bandwidth fairly among processes.

The I/O scheduler was originally designed to minimize mechanical seek time on hard disks. With fast SSDs and NVMe drives that have their own internal queues, its role has shifted toward latency control and fairness, and in many configurations the best choice is to do almost nothing.

How an I/O scheduler processes requests

An I/O scheduler processes requests by collecting them in software queues, applying a policy, and dispatching them to the driver when the device can accept more work. Each request describes a direction, a starting sector and a length, which gives the scheduler enough information to detect adjacency and estimate cost.

Two core operations do most of the work. Merging joins a new request with an adjacent queued request so that the device receives one larger transfer instead of several small ones. Sorting orders requests by sector or by deadline, so a hard disk head sweeps across the platter instead of jumping back and forth.

The table summarizes the basic operations that a scheduler can apply.

OperationWhat it doesMain benefit
Front and back mergingJoins requests for adjacent sectorsFewer, larger transfers
Sector sortingOrders requests by disk positionShorter seeks on hard disks
Deadline assignmentGives each request an expiry timePrevents starvation
Anticipation or idlingWaits briefly for a nearby requestPreserves sequential patterns
Budget accountingTracks service per process or groupFair bandwidth sharing
Core operations of an I/O scheduler

Classic disk scheduling algorithms

Classic disk scheduling algorithms were developed for rotating disks, where seek time and rotational latency dominate service time. They remain the textbook foundation for understanding any I/O scheduler, even though modern kernels implement refined variants.

The algorithms differ mainly in how they balance total head movement against the risk that distant requests wait too long.

AlgorithmOrdering ruleStrengthWeakness
FCFSArrival orderSimple and fairLong seeks
SSTFNearest request firstLow average seekCan starve far requests
SCAN (elevator)Sweep in one direction, then reverseBounded waitingEdges served less often
C-SCANSweep one way, jump backMore uniform wait timesReturn sweep is unused
LOOK and C-LOOKLike SCAN, stop at last requestAvoids empty travelStill position-driven
Classic algorithms and their trade-offs

These algorithms assume the scheduler knows the physical geometry of the disk. Modern drives hide geometry behind logical block addresses and reorder commands internally through Native Command Queuing, which limits how much the operating system can optimize.

I/O schedulers in modern kernels

Modern kernels ship several I/O schedulers that administrators can select per device. Linux moved to the multi-queue block layer (blk-mq), which maps per-CPU software queues to hardware queues and supports schedulers designed for devices that process many commands in parallel.

SchedulerPolicyBest suited to
nonePasses requests straight throughFast NVMe devices
mq-deadlineSorted queues with read and write deadlinesSATA SSDs and general servers
BFQBudget Fair Queueing per processDesktops and slow media
KyberToken-based latency targetsFast devices needing latency control
Schedulers available in the multi-queue block layer

Windows does not expose a selectable scheduler in the same way. Instead, its storage stack uses I/O priorities and bandwidth reservation, while the storport miniport driver and the device firmware handle ordering. In both systems, hardware queue depth strongly influences how much reordering is still useful.

Choosing an I/O scheduler for a device

Choosing an I/O scheduler depends mainly on the device type and the workload mix. On a device that services commands in tens of microseconds, scheduler overhead and lock contention can cost more than the scheduler saves, while a slow disk benefits greatly from merging and sorting.

The decision table below reflects common practice; measurements on the real workload should always confirm the choice.

SituationRecommended choiceReason
NVMe database servernoneDevice parallelism exceeds scheduler gains
SATA SSD in a servermq-deadlineLow overhead with starvation protection
Desktop with hard diskBFQKeeps applications responsive during copies
Mixed tenants on shared storageBFQ or group throttlingEnforces fair bandwidth shares
Latency-sensitive fast storageKyberTargets read and write latency
Typical scheduler choices by situation

Limitations and common mistakes

An I/O scheduler can only reorder what it sees, so its effect is limited by layers below and above it. Virtual machines, RAID controllers and storage arrays often reorder requests again, which can cancel or distort the policy chosen in the guest.

  • Using a seek-optimizing scheduler on NVMe adds CPU overhead without reducing latency.
  • Expecting the scheduler to fix a saturated device; no ordering policy can create bandwidth that the hardware lacks.
  • Ignoring the page cache and writeback behavior, which often shapes I/O patterns more than the scheduler does.
  • Tuning in a guest while the host scheduler makes the real decisions.
  • Benchmarking with synthetic sequential loads when the production workload is random and mixed.

Because direct memory access and interrupt handling complete the transfer after dispatch, end-to-end latency also depends on the driver and interrupt path, not only on queue order.

Understanding it simply

Programs constantly ask the computer to read and save data on its drive. These requests arrive in a jumbled order. The I/O scheduler is the part of the system that puts the requests in a sensible order before the drive handles them.

Picture a delivery driver with twenty parcels. Driving to the addresses in the order the parcels arrived wastes time. Grouping nearby streets saves fuel, but no customer should wait all day. A good scheduler finds the balance between speed and fairness. Fast modern drives need less help, so the scheduler often steps back.

Applied in practice

A small company runs a file server with a large hard disk array that stores project archives, while staff also use it for shared documents. During nightly backups, opening a single document during working hours took several seconds, because long sequential backup reads filled the queue.

The administrator switches the disks from a simple pass-through policy to BFQ and assigns the backup job a low I/O priority. BFQ now gives each process a bandwidth budget, so short interactive reads are served between batches of backup requests instead of waiting behind them.

Document opening times drop to under half a second, while the backup finishes about 10 percent later. On the same server, the new NVMe cache drive keeps the none scheduler, because measurements show that any reordering only adds overhead on that device.