Your SlideShare is downloading. ×
0
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
20061021 2 6_io_sched
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

20061021 2 6_io_sched

733

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
733
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. linux 2.6 Kernel I/O schedule introduction on conception from internet...
  • 2. Content ● What's I/O schedler? (elevator) ● Linux I/O scheduler framework ● I/O scheduler ● Noop elevator ● Linus elevator ● Deadline I/O scheduler ● Anticipatory I/O scheduler ● Completely fair queuing ● Conclusion
  • 3. What is I/O scheduler? ● The I/O scheduler schedules the pending I/O requests in order to minimize the t ime spent moving the disk head. This, i n turn, minimizes disk seek time and ma ximizes hard disk throughput. ● Share and control bandwith of hard disk throughput.
  • 4. What is I/O scheduler? (Cont.) ● Why need a scheduler? – First of all, look inside of hard disk
  • 5. What is I/O scheduler? (Cont.) ● Why need a scheduler? – How data written or read ● the write head is an induction coil ● the read head is a magnetoresistive(MR) sensor
  • 6. What is I/O scheduler? (Cont.) ● Why need a scheduler? – How data addressed ● Head is moved across the C.H.S (LBA address)
  • 7. What is I/O scheduler? (Cont.) ● Why need a scheduler? – seek time: time it takes to position the head at the track – rotational delay: time it takes for the beginning of the sector to reach the head – access time= seek time + rotational delay – transfer time: time required for sector data tran sfer5.
  • 8. What is I/O scheduler? (Cont.) ● Disk seek is the slowest operation in a computer – A system would perform horribly without a suitabl e I/O scheduler ● I/O scheduler arranges the disk head to move in a si ngle direction to minimize seeks – Like the way elevators moves between floors – Achieve greater global throughput at the expense of fairness to some requestss
  • 9. What is I/O scheduler? (Cont.) I/O scheduler's job ● Improve overall disk throughput by – Reordering and sorting requests to reduce the disk seek time – Merging requests to reduce the number of requests ● Prevent starvation – Submit requests before deadline – Avoid read starvation by write ● Provide fairness among different processes
  • 10. Linux I/O scheduler framework ● Linux elevator is an abstract layer to which different I/O scheduler can attach ● Merging mechanisms are provided by request queues – Front or back merge of a request and a bio – Merge two requests ● Sorting policy and merge decision are done in elevators – Pick up a request to be merged with a bio – Add a new request to the request queue – Select next request to be processed by block driverselevator
  • 11. Linux I/O scheduler framework ● Mina idea of Linux I/O scheduler framework – Internal queue: used inside I/O scheduler – external queue: device driver visible queue
  • 12. Linux I/O scheduler Noop elevator ● Suitable for truly random-access device, like RAM disk ● Requests in the queue are kept in FIFO order ● Only the last request added to the request queue will be tested for the possibility of a merge ● For Flash device, need some modification, to make life of chip longer.
  • 13. Linux I/O scheduler Linus elevator ● The Linus Elevator functions almost exactly like the classic I/O scheduler (sort and merge). ● For the most part, this was great because simplicity is a good thing and the 2.4 kernel's I/O scheduler just worked. ● Unfortunately, in the I/O scheduler's quest to max- imize global I/O throughput, a trade-off was made: local fairness --- in particular, request latency --- can go easily out the window.
  • 14. Linux I/O scheduler Deadline elevator ● The Deadline I/O Scheduler was introduced to solve the starvation issue surrounding the 2.4 I/O sched- uler and traditional elevator algorithms in general.
  • 15. Linux I/O scheduler Deadline elevator (cont) ● Goal – Reorder requests to improve I/O performance while simultan- eouslyensuring that no I/O request is being starved – Favor reads over writess ● Each requests is associated with a expire time – Read: 500ms, write 5sec ● Requests are inserted into – A sorted-by-start-sector queue (two queues! for read and write) – A FIFO list (two lists too!) sorted by expire time ● Normally, requests are pulled from sorted queues. However, if the request at the head of either FIFO queue expires, requests are still processed in sor- ted order but started from the first request in the FIFO queue
  • 16. Linux I/O scheduler Deadline elevator (cont)
  • 17. Linux I/O scheduler Deadline elevator (cont) ● The Deadline I/O Scheduler can enforce a soft dead- line on I/O requests. ● Although it makes no promise that an I/O request is serviced before the expiration time, the I/O sched- uler generally services requests near their expira- tion times. ● Deadline I/O Scheduler continues to provide good global throughput without starving any one request for an unacceptably long time. Because read requests are given short expiration times, the writes- starving-reads problem is minimized.
  • 18. Linux I/O scheduler Anticipatory elevator ● Deadline elevator is perfect, but not best. VS
  • 19. Linux I/O scheduler Anticipatory elevator (Cont.) ● Key idea: – Sometimes wait for process whose request was last serviced. – Keeps disk idle for short intervals. ● But with informed decisions, this idea: – Improves throughput – Achieves desired proportions ● Balance expected benefits of waiting against cost of keeping disk idle.
  • 20. Linux I/O scheduler Anticipatory elevator (Cont.) ● Based on deadline I/O scheduler ● Suitable for desktop, good interactive performance ● Design shortcomings – Assume only 1 physical seeking head ● Bad for RAID devices – Only 1 read request are dispatched to the disk controller at a time ● Bad for controller that supports TCQ(Tagged Command Queuing) – Read anticipation assumes synchronous requests are issued by individual processes ● Bad for requests issued cooperatively by multiple pro- cesses ● Rough benefit-cost analysis – Anticipate a better request if mean thinktimeof the process < 6ms and mean seek distance of the process < seek distance of next requests
  • 21. Linux I/O scheduler Anticipatory elevator (Cont.) ● One-way elevator algorithm – Limited backward seeks ● FIFO expiration times for reads and for writes – When a requests expire, interrupt the current elevator sweep ● Read and write request batching – Scheduler alternates dispatching read and write batches to the driver. The read (write) FIFO timeout values are tested only during read(write) batches. ● Read Anticipation – At the end of each read request, the I/O scheduler examines its next candidate read request from its sorted read list and decide whether to wait for a “better request”
  • 22. Linux I/O scheduler Anticipatory elevator (Cont.) ● Robert Love's testing results Test 1: Test 2: task 1 task 1 while true while true do do dd if=/dev/zero of=file bs=1M cat big-file > /dev/null done done task 2 task 2 time cat 200mb-file > /dev/null time find . -type f -exec cat '{}' ';' > /dev/null I/O Scheduler and Kernel Test 1 Test 2 Linus Elevator on 2.4 45 seconds 30 minutes, 28 seconds Deadline I/O Scheduler on 2.6 40 seconds 3 minutes, 30 seconds Anticipatory I/O Scheduler on 2.6 4.6 seconds 15 seconds
  • 23. Linux I/O scheduler CFQ elevator CFQv2 (Complete Fair Queuing) I/O scheduler ● Goal – Provide fair allocation of I/O bandwidth among all the ini- tiators of I/O requests ● CFQ can be configured to provide fairness at per- process, per-process-group, per-user and per-user- group levels. ● Each initiator has its own request queue and CFQ services these queues round-robin – Data write back is usually performed by the pdflush kernel threads. That means, all data writes share the alloted I/O bandwidth of the pdflush threadsa
  • 24. Linux I/O scheduler CFQ elevator (Cont.)
  • 25. Linux I/O scheduler CFQ elevator (Cont.) Redhat Says: ● The Completely Fair Queuing (CFQ) scheduler is the default algorthim in Red Hat Enterprise Linux 4. ● As the name implies, CFQ maintains a scalable per- process I/O queue and attempts to distribute the available I/O bandwidth equally among all I/O re- quests. ● CFQ is well suited for mid-to-large multi-processor systems and for systems which require balanced I/O performance over multiple LUNs and I/O controllers.
  • 26. Conclusion Every dog has its day. ● Every elevator has its advantage, even the NOOP el- evator. ● What is the best performance, depends on the applic- ations. ● Analyze the application, adopt proper elevator, you will achieve best performance. ● Dynamic elevator selecting is under discussion and developing. ● Linux kernel changes everyday, follow the kernel email list for latest news.
  • 27. Thank you ! Q & A

×