Princess Nora University
Computer Sciences Department
Operating Systems
CS 340
1
Term 1 - 1446
Chapter-9
Mass Storage Structure
(covered in chapter 10 of textbook)
Introduction
Chapter 9: Mass Storage Structure
1. Overview of Mass Storage Structure
2. Disk Structure
3. Disk Scheduling Algorithms
3
OBJECTIVES:
➢ To describe the physical structure of secondary storage devices
and its effects on the uses of the devices.
➢ To explain the performance characteristics of mass-storage
devices and it scheduling algorithms
4
Overview
5
Moving-head Disk Mechanism
❑Each disk platter has a
flat circular shape, like a
CD
❑The surface of a platter
is logically divided into
circular tracks, which
are subdivided into
sectors.
❑ The set of tracks that
are at one arm position
makes up a cylinder.
6
Overview of Mass Storage Structure
❑ Magnetic disks provide bulk of secondary storage of
modern computers
➢ Drives rotate at 60 to 200 times per second
➢ Disk speed has two parts.
❖ Transfer rate is rate at which data flow between drive and
computer
❖ Positioning time (/random-access time) consists of :
▪ seek time: time to move disk arm to desired cylinder
▪ rotational latency: time for desired sector to rotate under
the disk head.
❑ Disks can be removable
7
Overview of Mass Storage Structure (cont.)
❑ Disk drive attached to computer via set of wires (I/O
bus)
❑ The data transfers on a bus are carried out by special
electronic processors called controllers.
➢ The host controller is the controller at the computer end
of the bus.
➢ A disk controller is built into each disk drive
➢ To perform disk I/O operation >> Host controller uses bus
to talk to disk controller.
8
Disk Structure
9
Disk Structure
❑ Disk drives are addressed as large 1-D arrays of logical blocks,
where the logical block is the smallest unit of transfer
❑ The 1-D array of logical blocks is mapped into the sectors of the disk
sequentially
➢ Sector 0 is the first sector of the first track on the outermost
cylinder
➢ Mapping proceeds in order through that track, then the rest of
the tracks in that cylinder, and then through the rest of the
cylinders from outermost to innermost
10
Disk Scheduling
11
Disk Scheduling
❑ The operating system is responsible for using hardware efficiently
➢ for the disk drives>> this means having a fast access time and large
disk bandwidth
❑ Access time has two major components
➢ Seek time
➢ Rotational latency
❑ Disk bandwidth is the total number of bytes transferred, divided by
the total time between the first request for service and the completion
of the last transfer
❑ We can improve both the access time and the bandwidth by managing the
order in which disk I/O requests are serviced.
➢ Minimize seek time (Seek time ∝ seek distance)
12
Disk Scheduling Algorithms
❑ Some algorithms to schedule the servicing of disk I/O requests:
➢ FCFS (first-come, first-served)
➢ SSTF (shortest-seek-time-first)
➢ SCAN
13
Disk Scheduling Algorithms
❑ Algorithm (1): FCFS (first-come, first-served):
❖ (slowly & simple)
❖ EXAMPLE:
• A disk drive has 200 cylinders,
• The queue of pending requests is:
98, 183, 37, 122, 14, 124, 65, 67
• The current head position= 53
awww
oooo
Head movement sequence: 53 » 98 » 183 » 37 » 122 » 14 » 124 » 65 » 67
The total seek distance = ∑ │ current position- next position│
= 45 +85 + 146 + 85 +108+110 +59+2 =640 cylinders.
14
Disk Scheduling Algorithms
❑ Algorithm (2): SSTF (shortest-seek-time-first) algorithm
❖ Selects the request with the minimum seek time from the
current head position (i.e. service all the requests close to the
current head position before moving the head far away to service
other requests)
❖ SSTF scheduling is a form of SJF scheduling; may cause
starvation of some requests
❖ SSTF is not optimal
15
Disk Scheduling Algorithms (Cont.)
❖ EXAMPLE: SSTF algorithm
• A disk drive has 200 cylinders,
• The queue of pending requests is:
98, 183, 37, 122, 14, 124, 65, 67
u
• The current head position= 53
Head movement sequence: 53 » 65 » 67 » 37 » 14 » 98 » 122 » 124 » 183
The total seek distance = ∑ │ current position- next position│
=236 cylinders….(better than FCFS algorithm)
16
Disk Scheduling Algorithms (Cont.)
➢ Algorithm (3): SCAN algorithm
o 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.
o SCAN algorithm Sometimes called the elevator algorithm
o Before applying SCAN to schedule we need to know the direction
of head movement
17
Disk Scheduling Algorithms (Cont.)
❖ EXAMPLE: SCAN algorithm
• A disk drive has 200 cylinders
(0-199)
• The queue of pending requests is:
98, 183, 37, 122, 14, 124, 65, 67
• The current head position= 53
Assuming that head direction:
from cylinder# 199 to cylinder #0
(C199 >>C0)
Head movement sequence: 53 » 37 » 14 » 0 » 65 » 67 » 98 » 122 » 124 » 183
The total seek distance = ∑ │ current position- next position│
=16+23+14+65+2+31+24+2+59 = 236 cylinders
NOTE: if we reverse the direction, the result almost will be different.
18
Thank you
End of Chapter 9
19