This document discusses disk scheduling algorithms. It covers factors that affect algorithm selection such as request types and file allocation methods. It also summarizes common algorithms like FCFS, SSTF, SCAN, C-SCAN, and C-LOOK and how they work. SSTF and LOOK are generally good default choices but SCAN and C-SCAN perform better under heavy disk loads. The document aims to help understand how to choose the best disk scheduling algorithm.
2. Recap
In the last class, you have learnt:
• LOOK and C-LOOK Scheduling
http://raj-os.blogspot.in/ 2
3. • HOME PREVIOUS TOPIC NEXT
• PREVIOUS QUESTION PAPERS FOR
OS
• CPP TUTORIALS
http://raj-os.blogspot.in/ 3
4. Objectives
On 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. Selection of a Disk-Scheduling algorithm
Given so many scheduling algorithms how do we
choose the best one?
• SSTF is common and has a natural appeal because it
increases performance over FCFS
http://raj-os.blogspot.in/ 5
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. 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. 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. 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. 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. 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. 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. 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. 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. Disk Scheduling
• Minimize seek time
• Seek time ≈ Seek distance
Disk 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. 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
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
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
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
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
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. 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. Summary
In 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. Frequently Asked Questions
1. How to select a disk scheduling algorithm?
2. List the factors that effect the disk scheduling
algorithm
http://raj-os.blogspot.in/ 29
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. 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. Other subject materials
• Web designing
• Micro processors
• C++ tutorials
• java
home
http://raj-os.blogspot.in/ 33