The I/O scheduling subsystem is used to schedule I/O requests from multiple processes to block devices.
Elevator Dispatch
- First, if a request for an adjacent disk sector operation already exists in the queue, the new request is merged into a single request with the existing request.
2. If there is a long-lived request in the queue, the new request will be inserted at the end of the queue to prevent starvation of other old requests.
3. If there is an appropriate insertion position in the queue with a sector orientation, the new request will be inserted into that location, ensuring that the requests in the queue are ordered in the physical location of the accessed disk.
4. If there is no suitable request insertion location in the queue, the request will be inserted at the end of the queue.
Deadline IO Scheduling
In the deadline I/O scheduler, each request has a time-out. By default, the time-out for a read request is 500ms, and the time-out for the write request is 5s.
The deadline IO scheduling request is similar to the Linux elevator, which also maintains the request queue in order of the physical location of the disk, which is called the sort queue. When a new request is submitted to the sort queue, the deadline IO scheduler resembles the Linux elevator, merging and inserting requests,
The deadline I/O scheduler also inserts them into additional queues on the basis of the request type. Read requests are inserted sequentially into a specific read FIFO queue, and write requests are inserted into a specific write FIFO queue.
Predictive IO Scheduler
The basis is the deadline IO scheduler. The main improvement is that it adds predictive heuristics.
The difference is that the read operation does not return directly to the processing of other requests, but is intentionally idle for a moment. This idle seconds is a good opportunity for the application to submit other read requests-any requests for adjacent disk location operations will be processed immediately. (based on the actual occurrence of the statistical effect is good)
Fully-justified queued I/O Scheduler
The fully-impartial queueing I/O Scheduler (complete Fair Queuing, abbreviated CFQ) is designed for proprietary workloads. The CFQI/O Scheduler puts incoming I/O requests into a specific queue, which is organized according to the process that caused the I/O request. In each queue, the incoming request is merged with the adjacent request and inserted into the classification, and the queue is categorized by sector mode. The difference between the CFQI/O scheduler is that each process that submits an I/O request has its own queue.
The CFQI/O Scheduler schedules queues in time slices, picks the number of requests from each queue (default is 4), and then makes the next round of scheduling.
The I/O Scheduler is implemented in DRIVERS/BLOCK/CFQ-IOSCHED.C.
"Linux kernel design and implementation" Learning note--i/o scheduling algorithm