Disk scheduling algorithm.52

10,169 views
9,845 views

Published on

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
10,169
On SlideShare
0
From Embeds
0
Number of Embeds
18
Actions
Shares
0
Downloads
275
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Disk scheduling algorithm.52

  1. 1. Disk scheduling algorithms summary http://raj-os.blogspot.in/ 1
  2. 2. RecapIn the last class, you have learnt:• LOOK and C-LOOK Scheduling http://raj-os.blogspot.in/ 2
  3. 3. • HOME PREVIOUS TOPIC NEXT• PREVIOUS QUESTION PAPERS FOR OS• CPP TUTORIALS http://raj-os.blogspot.in/ 3
  4. 4. ObjectivesOn Completion of this period, you would be able to know• How to select a Disk-Scheduling algorithm• Factors affecting the Disk-Scheduling algorithm• Implementation of Disk-Scheduling algorithm• Summary of disk scheduling algorithm http://raj-os.blogspot.in/ 4
  5. 5. Selection of a Disk-Scheduling algorithmGiven so many scheduling algorithms how do wechoose the best one?• SSTF is common and has a natural appeal because it increases performance over FCFS http://raj-os.blogspot.in/ 5
  6. 6. Selection of a Disk-Scheduling Algorithm• SCAN and C-SCAN perform better for systems that place a heavy load on the disk• SCAN and C-SCAN are less likely to cause a starvation problem http://raj-os.blogspot.in/ 6
  7. 7. Selection of a Disk-Scheduling Algorithm• For any particular list of requests we can define an optimal order of retrieval• But the computations needed for finding a optimal schedule may not justify the savings over SSTF or SCAN http://raj-os.blogspot.in/ 7
  8. 8. Factors affecting Disk-Scheduling Algorithm• With any scheduling algorithm – Performance depends heavily on the number and type of requests• If the queue has only one outstanding request – All scheduling algorithms behave as FCFS http://raj-os.blogspot.in/ 8
  9. 9. Factors affecting Disk-Scheduling Algorithm• Requests for disk service can be influenced by the file- allocation method – A program reading contiguously allocated file • Generate several requests that are close together on the disk • Resulting in limited head movement – A program reading linked or indexed allocated file • Generate several requests that include blocks scattered on the disk • Resulting in greater head movement http://raj-os.blogspot.in/ 9
  10. 10. Factors affecting Disk-Scheduling Algorithm• The disk Scheduling algorithms considers only the seek distances• For modern disks the rotational latency can be nearly as large as the average seek time http://raj-os.blogspot.in/ 10
  11. 11. Factors affecting Disk-Scheduling Algorithm• It is difficult for the operating system to schedule for improved rotational latency – Because modern disks does not disclose physical location of logical blocks• In modern disks the disk scheduling algorithms are built in the disk drive http://raj-os.blogspot.in/ 11
  12. 12. Implementation of a Disk-Scheduling Algorithm• If the OS sends a batch of requests to the controller• The controller queues them and then schedule them to improve – Both the SEEK time and the Rotational latency http://raj-os.blogspot.in/ 12
  13. 13. Implementation of a Disk-Scheduling Algorithm• The disk-scheduling algorithm should be written as a separate module of the operating system – Allowing it to be replaced with a different algorithm if necessary• Either SSTF or LOOK is a reasonable choice for the default algorithm http://raj-os.blogspot.in/ 13
  14. 14. Disk Scheduling• The operating system is responsible for using hardware efficiently for the disk drives, – This means having a fast access time and disk bandwidth• Access time has two major components – Seek time is the time for the disk to move the heads to the cylinder containing the desired sector – Rotational latency is the additional time waiting for the disk to rotate the desired sector to the disk head http://raj-os.blogspot.in/ 14
  15. 15. Disk Scheduling• Minimize seek time• Seek time ≈ Seek distanceDisk bandwidth is the total number of bytes transferred,The total time between the first request for service and the completion of the last transfer http://raj-os.blogspot.in/ 15
  16. 16. Disk Scheduling• Several algorithms exist to schedule the servicing of disk I/O requests• We illustrate them with a request queue (0-199) – Tracks 98, 183, 37, 122, 14, 124, 65, 67 – Head pointer 53 http://raj-os.blogspot.in/ 16
  17. 17. Illustration shows total head movement of 640 cylinders FCFS http://raj-os.blogspot.in/ 17
  18. 18. SSTF• Selects the request with the minimum seek time from the current head position• SSTF scheduling is a form of SJF scheduling; may cause starvation of some requests• Illustration shows total head movement of 236 cylinders http://raj-os.blogspot.in/ 18
  19. 19. SSTF SSTFhttp://raj-os.blogspot.in/ 19
  20. 20. SCAN• The disk arm starts at one end of the disk, and moves toward the other end, – servicing requests until it gets to the other end of the disk, – where the head movement is reversed and servicing continues• Sometimes called the elevator algorithm• Illustration shows total head movement of 208 cylinders http://raj-os.blogspot.in/ 20
  21. 21. SCAN SCANhttp://raj-os.blogspot.in/ 21
  22. 22. C-SCAN• Provides a more uniform wait time than SCAN• The head moves from one end of the disk to the other servicing requests as it goes – When it reaches the other end, however, it immediately returns to the beginning of the disk, without servicing any requests on the return trip• Treats the cylinders as a circular list that wraps around from the last cylinder to the first one http://raj-os.blogspot.in/ 22
  23. 23. C-SCAN C-SCANhttp://raj-os.blogspot.in/ 23
  24. 24. C-LOOK• Version of C-SCAN• Arm only goes as far as the last request in each direction, – then reverses direction immediately, without first going all the way to the end of the disk http://raj-os.blogspot.in/ 24
  25. 25. C-LOOK C-LOOKhttp://raj-os.blogspot.in/ 25
  26. 26. Selecting a Disk-Scheduling Algorithm• SSTF is common and has a natural appeal• SCAN and C-SCAN perform better for systems that place a heavy load on the disk• Performance depends on the number and types of requests http://raj-os.blogspot.in/ 26
  27. 27. Selecting a Disk-Scheduling Algorithm• Requests for disk service can be influenced by the file-allocation method• The disk-scheduling algorithm should be written as a separate module of the operating system, – allowing it to be replaced with a different algorithm if necessary• Either SSTF or LOOK is a reasonable choice for the default algorithm. http://raj-os.blogspot.in/ 27
  28. 28. SummaryIn this class, you have learnt: – Disk Scheduling – Various Disk Scheduling algorithms – Selection of a particular Disk Scheduling algorithm – Summary of Disk Scheduling algorithm http://raj-os.blogspot.in/ 28
  29. 29. Frequently Asked Questions1. How to select a disk scheduling algorithm?2. List the factors that effect the disk scheduling algorithm http://raj-os.blogspot.in/ 29
  30. 30. Frequently Asked Questions3. Compare various scheduling algorithm http://raj-os.blogspot.in/ 30
  31. 31. Quiz• SCAN and C-SCAN perform better for systems that place a heavy load on the disk. [T/F] TRUE• If the queue has only one outstanding request all scheduling algorithms behave as FCFS [T/F] TRUE http://raj-os.blogspot.in/ 31
  32. 32. Quiz• C-LOOK algorithm is a version of C-SCAN [T/F] TRUE• SCAN and C-SCAN perform better for systems that place a heavy load on the disk. [T/F] TRUE http://raj-os.blogspot.in/ 32
  33. 33. Other subject materials• Web designing• Micro processors• C++ tutorials• javahome http://raj-os.blogspot.in/ 33

×