From bfaa396f27e0d9b9d116e05de59646c7e374baa1 Mon Sep 17 00:00:00 2001 From: firmianay Date: Tue, 30 May 2017 15:04:26 +0800 Subject: [PATCH] finish LKD 14.md --- linux-kernel-development/chapter-14.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/linux-kernel-development/chapter-14.md b/linux-kernel-development/chapter-14.md index 5e04e4f..41f19fe 100644 --- a/linux-kernel-development/chapter-14.md +++ b/linux-kernel-development/chapter-14.md @@ -140,3 +140,21 @@ Each request can be composed of more than one `bio` structure because individual ## I/O Schedulers +The subsystem of the kernel that performs these operations is called the I/O scheduler. The I/O scheduler divides the resource of disk I/O among the pending block I/O requests in the system. + +### The Job of an I/O Scheduler +An I/O scheduler works by managing a block device's request queue. It decides the order of requests in the queue and at what time each request is dispatched to the block device. It manages the request queue with the goal of reducing seeks, which results in greater `global throughput`. + +I/O scheduler perform two primary actions to minimize seeks: +- `merging`: the coalescing of two or more requests into one. +- `sorting`: the entire request queue is kept sorted, sectorwise. + +### I/O Scheduler Selection +There are four different I/O schedulers in the 2.6 kernel. Each of these I/O schedulers can be enabled and built into the kernel. By default, block devices use the Complete Fair Queuing I/O scheduler. This can be overridden via the boot-time option `elevator=foo` on the kernel command line, where `foo` is a valid and enabled I/O Scheduler. + +Parameter | I/O Scheduler +--------- | ------------- +as | Anticipatory +cfq | Complete Fair Queuing +deadline | Deadline +noop | Noop