Operating Systems (CS3000)
Lecture – 20
(Disk Management – 1)
Dr. Jaishree Mayank
Assistant Professor
Department of Computer Sc. and Engg.
Disk Structure
• Each Disk has platter
• Each platter has two
surfaces.
• Each surface is divided
into tracks.
• Each track is divided
into sector.
• Sector store the data
Problems 1
Consider a Disk that has 16 platters. Each platter is divided into two surfaces.
Every surface is divided into 1K tracks. Every track is divided into 512 sectors.
Each sector can store 2KB of data.
(a)What is the capacity of the disk?
(b) How many bits are required to identify the sector?
Consider a Disk that has 16 platters. Each platter is divided into two surfaces.
Every surface is divided into 1K tracks. Every track is divided into 512 sectors.
Each sector can store 2KB of data.
(a)What is the capacity of the disk?
(2^4) x 2 x (2^10) x (2^9) x (2^11)=(2^35)=32GB
(b) How many bits are required to identify the sector?
4+1+10+9=24 bits
Disk Operations
The read-write header can be on any particular track.
•First the header is moved from current track to desired track.
•Then the header will wait for the desired sector as the disk is moving in clockwise or
anticlockwise:
•Seek Time:-The amount of time taken to move the r/w head from its current position to
the desired track.
•Rotational Latency:-The amount of time taken to rotate the track when the read/write
header comes to exact position (sector)
Rotational latency=1/2 rotation time(avg)
• Transfer Time:-The amount of time is taken to transfer the
required data is called Transfer time.
• Transfer time depends on the rotational rate of the disk and the
total size of the track.
• Transfer Rate:-The number of bytes transferred per unit time.
• Total Access Time= Seek Time+ Rotational Latency+Tranfser time
Problem 1
Consider a disk that has average seek time of 30 s.
• The rotational rate of 360 rpm.
• Each track has 512 sectors and each size is 512 KB.
What is the time required to read four successive sectors?
Av. Seek Time= 30ns
Av. Rotational latency= (60/360)x(1/2)
Transfer Time
In one Rotation we transfer= 512 sectors x 512 Kbytes= 2^28=256MB
Required data is from 4 sectors= 4 x 512KB= 2MB
256MB in 60/360 s
2MB=(60/360)*(2/256) sec
Total Access Time= seek Time+ Rotational latency+ Transfer Time
Disk Scheduling
For efficient use of disk drives, the disk must have
•fast access time
•large disk bandwidth: the total number of bytes transferred/the total time between the first request for service and the
completion of the last transfer.
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
• Minimize seek time
• Seek time =seek distance
• Rotational latency is the additional time waiting for the disk to rotate the desired
sector to the disk head
FCFS Disk Scheduling
SSTF Disk Scheduling
SSTF:-It chooses the pending request closest to the current head position.
•It perform well compared to FCFC
•It may cause starvation of some requests.
SSTF Disk Scheduling
SCAN and C-SCAN Disk Scheduling
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.
• SCAN algorithm Sometimes called the elevator algorithm
C-SCAN (Circular 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
SCAN Disk Scheduling
C-SCAN Disk Scheduling
LOOK and C-LOOK Disk Scheduling
LOOK:-
• Arm only goes as far as the last request in each direction, then, where the head movement is reversed and
servicing continues
C-LOOK (Circular 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
LOOK Disk Scheduling
C-LOOK Disk Scheduling
Problem
A disk has 200 tracks (numbered 0 through 199).
At a given time, it was servicing the request of reading data from track 120, and at the previous request,
service was for track 90.
The pending requests (in order of their arrival) are for track numbers. 30 70 115 130 110 80 20 25.
How many times will the head change its direction for the disk scheduling policies SSTF(Shortest Seek
Time First), FCFS(First Come Fist Serve), SCAN and C-SCAN
Solution: SSTF
FCFS
SCAN
C-SCAN
Problem
Problem
A disk has 200 tracks (numbered 0 through 199).
At a given time, it was servicing the request of reading data from track 120, and at the previous request,
service was for track 90.
The pending requests (in order of their arrival) are for track numbers. 30 70 115 130 110 80 20 25.
How many times will the head change its direction for the disk scheduling policies SSTF(Shortest Seek
Time First), FCFS(First Come Fist Serve), SCAN and C-SCAN
Solution: SSTF=3
FCFS=4
SCAN=1
C-SCAN=2
Thank You
Any Questions?