CCS 2203
OPERATING SYSTEMS
Module 4 – Storage Management
LEARNING OUTCOMES:
At the end of this module, you should be able to:
Learn the hardware activities involved in the
retrieval/storage of data on a direct access
storage device.
Compute different Disk Scheduling algorithms in
order to make contrasts and comparisons of
performance.
Appreciate the distinctive qualities of the
different scheduling algorithms and its effect to
storage management.
OVERVIEW
Since main memory is usually too small to
accommodate all the data and programs permanently,
the computer system must provide secondary storage
to back up main memory. Modern computer systems
use disks as the primary on-line storage medium for
information (both programs and data). The file
system provides the mechanism for on-line storage of
and access to both data and programs residing on the
disks. A file is a collection of related information
defined by its creator. The files are mapped by the
operating system onto physical devices. Files are
normally f organized into directories for ease of use.
OVERVIEW
The devices that attach to a computer vary in many
aspects. Some devices transfer a character or a block
of characters at a time. Some can be accessed only
sequentially, others randomly. Some transfer data
synchronously, others asynchronously. Some are
dedicated, some shared. They can be read-only or
read-write. They vary greatly in speed. In many ways,
they are also the slowest major component of the
computer.
OVERVIEW
Because of all this device variation, the operating
system needs to provide a wide range of functionality
to applications, to allow them to control all aspects of
the devices. One key goal of an operating system's I/O
subsystem is to provide the simplest interface possible
to the rest of the system. Because devices are a
performance bottleneck, another key is to optimize
I/O for maximum concurrency.
TRADITIONAL MAGNETIC DISK STRUCTURE
Image Source: https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/images/Chapter10/10_01_DiskMechanism.jpg
FACTORS AFFECTING DISK PERFORMANCE
Seek Time
The time taken by the read / write head to reach the
desired track is called as seek time.
It is the component which contributes the largest
percentage of the disk service time.
The lower the seek time, the faster the I/O operation.
Seek time specifications:
Full stroke – It is the time taken by the read / write
head to move across the entire width of the disk from
the innermost track to the outermost track
Average - It is the average time taken by the read /
write head to move from one random track to another.
Track to Track - It is the time taken by the read-write
head to move between the adjacent tracks.
FACTORS AFFECTING DISK PERFORMANCE
Rotational Latency
The time taken by the desired sector to come under the
read / write head is called as rotational latency.
It depends on the rotation speed of the spindle.
Data Transfer Rate
The amount of data that passes under the read / write head
in a given amount of time is called as data transfer rate.
The time taken to transfer the data is called as transfer
time.
FACTORS AFFECTING DISK PERFORMANCE
Controller Overhead
The overhead imposed by the disk controller is called
as controller overhead.
Disk controller is a device that manages the disk.
Queuing Delay
The time spent waiting for the disk to become free is called
as queuing delay.
DISK SCHEDULING ALGORITHMS
Disk scheduling is done by operating systems
to schedule I/O requests arriving for the disk.
Disk scheduling is also known as I/O scheduling.
Multiple I/O requests may arrive by different processes
and only one I/O request can be served at a time by the
disk controller. Thus other I/O requests need to wait in
the waiting queue and need to be scheduled.
Two or more request may be far from each other so can
result in greater disk arm movement.
Hard drives are one of the slowest parts of the computer
system and thus need to be accessed in an efficient
manner.
DISK SCHEDULING ALGORITHMS
Method of ordering disk requests
based on cylinder number
moving the arm inwards and outwards along the
disk surface is the slowest mechanical operation
The disk scheduling algorithms determine the
sequence of disk requests to be accessed by the
access arm.
DISK SCHEDULING ALGORITHMS
1. FCFS (First Come, First Served)
Perform operations in order requested
No reordering of work queue
No starvation: every request is serviced
Poor performance
2. SSTF (Shortest Seek Time First)
After a request, go to the closest request in the work
queue, regardless of direction
Reduces total seek time compared to FCFS
Starvation is possible; stay in one area of the disk if very
busy
Switching directions slows things down
DISK SCHEDULING ALGORITHMS
3. SCAN
Go from the outside to the inside servicing requests and
then back from the outside to the inside servicing
requests
Repeats this over and over
Reduces variance compared to SSTF.
4. LOOK
Like SCAN but stops moving inwards (or outwards)
when no more requests in that direction exist.
DISK SCHEDULING ALGORITHMS
5. C-LOOK (circular look)
Moves inwards servicing requests until it reaches the
innermost cylinder, then jumps to the outside cylinder of
the disk without servicing any request
Repeats this over and over
variant: service requests from inside to outside, then
skip back to the innermost request.
6. C-SCAN (circular scan)
Moves inwards servicing requests until there are no
more requests in that direction, then it jumps to the
outermost outstanding requests
variant: service requests from inside to outside, and
then skip back to the innermost cylinder.
EXAMPLE: FCFS, SSTF, SCAN, LOOK
Given the following:
Request Queue: 23, 89, 132, 42, 187
Cylinders: 200
Head Pointer
Current Location: 100
Previous Location: 80
Seek Rate: 3 ms
Compute for the seek time and THM (total head
movement)
Disk Request: 23, 89, 132, 42, 187
FCFS
0 23 42 89 100 132 187 199
100
23
89
132
42
187
THM = (100 - 23) + (132 - 23) + (132 - 42) + (187 - 42)
THM = 77 + 109 + 90 + 145
THM = 421
SEEK TIME = THM x SEEK RATE
SEEK TIME = 421 x 3
SEEK TIME = 1263 ms
Disk Request: 23, 89, 132, 42, 187
SSTF
0 23 42 89 100 132 187 199
100
89
132
42
23
187
THM = (100 - 89) + (187 - 89) + (187 - 23)
THM = 273
SEEK TIME = 273 x 3
SEEK TIME = 819 ms
SCAN
0 23 42 89 100 132 187 199
100 132
187 199
89
42
23
Request Queue: 23, 42, 89, 132, 187
Previous Location: 80
THM = (199 - 100) + (199 - 23)
THM = 275
SEEK TIME = 275 x 3ms
SEEK TIME = 825 ms
SCAN (DOWNWARD DIRECTION)
0 23 42 89 100 132 187 199
89 100
42
23
0
132
187
Request Queue: 23, 42, 89, 132, 187
Previous Location: 180
THM = (100 - 0) + (187 - 0)
THM = 287
SEEK TIME = 287 x 3
SEEK TIME = 861 ms
LOOK
0 23 42 89 100 132 187 199
100 132
187
89
42
23
Request Queue: 23, 42, 89, 132, 187
Previous Location: 80
THM = (187 - 100) + (187 - 23)
THM = 251
SEEK TIME = 251 x 3
SEEK TIME = 753 ms
LOOK (DOWNWARD DIRECTION)
0 23 42 89 100 132 187 199
89 100
42
23
132
187
Request Queue: 23, 42, 89, 132, 187
Previous Location: 180
THM = (100 - 23) + (187 - 23)
THM = 241
SEEK TIME = 241 x 3
SEEK TIME = 723 ms
C-SCAN (UPWARD DIRECTION)
0 23 42 89 100 132 187 199
100 132
187 199
0 α
42
89
23
Request Queue: 23, 42, 89, 132, 187 α = 15 ms
Previous Location: 80
THM = (199 - 100) + (89 - 0) + 15
THM = 203
SEEK TIME = 188 x 3
SEEK TIME = 564 ms Source: https://media.giphy.com/media/d3g1lkA1srw1c3Di/source.gif
C-SCAN (DOWNWARD DIRECTION)
0 23 42 89 100 132 187 199
89 100
42
23
0
α 199
187
132
Request Queue: 23, 42, 89, 132, 187 α = 15 ms
Previous Location: 180
THM = (100 - 0) + (199 - 132) + 15
THM = 182
SEEK TIME = 167 x 3
SEEK TIME = 501 ms
C-LOOK (UPWARD DIRECTION)
0 23 42 89 100 132 187 199
100 132
187
α
23
42
89
Request Queue: 23, 42, 89, 132, 187 α = 15 ms
Previous Location: 80
THM = (187 - 100) + (89 - 23) + 15
THM = 168
SEEK TIME = 153 x 3
SEEK TIME = 459 ms
C-LOOK (DOWNWARD DIRECTION)
0 23 42 89 100 132 187 199
89 100
42
23
187
132
Request Queue: 23, 42, 89, 132, 187 α = 15 ms
Previous Location: 180
THM = (100 - 23) + (187 - 132) + 15
THM = 147
SEEK TIME = 132 x 3
SEEK TIME = 396 ms
REFERENCES:
Textbook References:
• Abraham Silberschatz, Greg Gagne, and Peter Baer Galvin, "Operating
System Concepts, Ninth Edition”
• Silberschatz, A. (2010). Operating system concepts. Hoboken, NJ : Wiley
• Silberschatz, A., et al (2009). Operating system concepts. Hoboken, NJ :
Wiley
• Gisela May A. Albano, and Angelito G. Pastrana, Fundamentals of
Operating System, A & C Printers, 2009.
Articles / Online:
• Storage Management [Retrieved from:
https://www.oreilly.com/library/view/operating-system-
concepts/9780471694663/pt04.html]
• Process Termination in OS [Retrieved from:
https://t4tutorials.com/process-termination-in-operating-systems/ ]
Journal/s:
• J.R. Celis, D. Gonzales, E. Lagda, L. Rutaquio, Jr., A comprehensive
Review for Disk Scheduling algorithm, International Journal of Computer
Science Issues 11(1) (2014) 74–79
END OF MODULE 4