Module 5 Disk Algo Examples
Module 5 Disk Algo Examples
• Let's take a disk with 180 tracks (0-179) and the disk queue
having input/output requests in the following order: 81, 110, 38,
156, 68, 172, 92, 10. The initial head position of the Read/Write
head is 45. Find the total number of track movements of the
Read/Write head using the FCFS algorithm.
THM= 521
Prof J V Gorabal ,CSE ATMECE,Mysore
SSTF( Shortest Seek Time First)
• Calculate seek times: For each request in the queue, calculate the seek
time (absolute difference) from the current head position.
• Select shortest seek: Choose the request with the shortest seek time as
the next to be serviced.
• Update head position: Move the head to the chosen track and repeat
steps 1-2 until all requests are served
• Serve requests: It serves requests in the current direction until there are no
more remaining.
• Initial Position: The disk head starts at one end of the disk (say, left or right).
• Direction: The head moves in a chosen direction (left or right) servicing all pending
requests in its path.
• End of Disk: Upon reaching the opposite end, the head reverses its direction and
starts servicing requests again.
• Repeat: This process continues back and forth, scanning the entire disk and servicing
all requests.
Prof J V Gorabal ,CSE ATMECE,Mysore
SCAN-Algo-Example Graph(L-R)
HP:55
THM=(250-55)+(250-15)=430
THM=(55-0)+(240-0)=295
Prof J V Gorabal ,CSE ATMECE,Mysore
C-SCAN
(65 - 53) + (98 - 65) + (122 - 98) + (124 - 122) + (183 - 124) + (1
99 - 183) + (199 - 0)
+ (10 - 0) + (40 - 10) =395
Prof J V Gorabal ,CSE ATMECE,Mysore
CSCAN-Example
• Consider, a disk contains 200 tracks (0-199) and the request queue
contains track number 82, 170, 43, 140, 24, 16,190, respectively.
The current position of R/W head is 50, and the direction is
towards the larger value. Calculate the total number of cylinders
moved by head using C-SCAN disk scheduling
3. Once it reaches the end of the disk in that direction, reverse its
direction, but instead of going all the way back, only serve requests
encountered until the start of the disk.
THM=(240-51)+ (240-15)=414
2. Serve requests in the direction it's currently moving, servicing the closest request first.
3. Once it reaches the end of the disk in that direction, instead of reversing and serving the
remaining requests, it jumps directly to the farthest request in the opposite direction.
4. Serve requests encountered in that new direction until it reaches the starting point of the
disk.