Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
89 views33 pages

Excerpts From Chap11 1 Luigi Logrippo U Ottawa

This document summarizes input/output management and disk scheduling. It discusses categories of I/O devices, characteristics of I/O, stages of I/O evolution including interrupts and direct memory access, OS design issues for I/O like efficiency and generality, I/O buffering techniques, disk scheduling policies like FIFO, SSTF, SCAN, and C-SCAN, and how to evaluate the performance of different policies.

Uploaded by

Kristian Czar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views33 pages

Excerpts From Chap11 1 Luigi Logrippo U Ottawa

This document summarizes input/output management and disk scheduling. It discusses categories of I/O devices, characteristics of I/O, stages of I/O evolution including interrupts and direct memory access, OS design issues for I/O like efficiency and generality, I/O buffering techniques, disk scheduling policies like FIFO, SSTF, SCAN, and C-SCAN, and how to evaluate the performance of different policies.

Uploaded by

Kristian Czar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 33

Input/Output Management and

Disk Scheduling

Chapter 11

1 Chapter 11
Categories of I/O devices

Human-readable:
printers
videodisplay
keyboard...

Machine Readable:
disk,
tape
sensors...

Communication
line
drivers
modems...
2 Chapter 11
Main Characteristics

Data rate (bits or bytes?)


Unit of transfer (bit, byte, or block)
Data format
Error conditions
Interrupt signaling

3 Chapter 11
Varying data rates....

4 Chapter 11
Stages of Evolution
No interrupts
Simple programmed I/O by CPU
Add simple controller to this: channel;
busy waiting or polling needed
CPU keeps asking channel whether it has finished

With interrupts
Add interrupts to this
simultaneous operation CPU & I/O
traffic I/O Memory still goes through CPU

Introduce DMA: a controller to minimize CPU


involvement.
CPU interrupted only after entire block has been
transferred
DMA has complex instruction set (e.g. if)

DMA is complete separate CPU


5 Chapter 11
Direct Memory Access

Takes control of the system from the CPU to


transfer data to and from memory over the
system bus
Cycle stealing is used to transfer data on the
system bus
CPU slowed down, but not as much as it would be
without DMA
The CPU pauses one bus cycle to allow DMA
to do its work
No interrupts occur until all data block
transferred

6 Chapter 11
Possible DMA configuration 1
(communication unit/DMA involves bus: inefficient)

7 Chapter 11
Possible DMA configuration 2
(communication betw. DMA and unit does not involve bus)

8 Chapter 11
Possible DMA configuration 3
(very flexible, facilitates the inclusion of additional I/O units)

9 Chapter 11
OS Design Issues

Efficiency
I/O is usually the bottleneck! Extremely slow
with respect to CPU
Generality:
Tryto handle devices as much as possible in
same manner
Use general-purpose primitives, hide
peculiarities of devices from high-level modules
everyfile can be treated in terms of read. write,
open, close, lock, unlock...
10 Chapter 11
Layering
Models
Lower
levels hide
details
from higher
ones

11 Chapter 11
I/O Buffering
Could buffer be in memory area of user process?
Probably not. Process in execution is subject to
paging, suspension, etc.
so I/O must occur in a separate memory area (next
solution)

12 Chapter 11
I/O Buffering
Block-Oriented
Information is stored in fixed sized blocks
Transfers are made a block at the time
Used for disks and tapes

Stream-oriented
Information unit is of variable size: a stream of bytes
special info, such as carriage return, will delimit its logical
parts
Used for terminals, printers, communication ports,
mouse and most other devices that are not secondary
storage

13 Chapter 11
Single Buffer

Block-oriented
Input transfers made to buffer
As soon as user takes data, new input can start
(similarly for output)
Read ahead, output and go (no wait)

14 Chapter 11
Shadow
Double buffering

More independence between I/O and


processing: a process can use the content
of one buffer while the I/O device works
with the other buffer
Normally invisible to programmer.

15 Chapter 11
Circular buffer

Generalized scheme, such as in the


producer-consumer problem
Sometimes the I/O device can be faster,
other times the user process can be faster
Peak demands are smoothed out

16 Chapter 11
Disk scheduling
Cylinder: the set of tracks that are in the same
position with respect to read/write head (but book
only considers tracks, not cylinders)

17 Chapter 11
Silberschatz
Disk performance parameters
To read or write, the disk head must be positioned
at the desired track and at the beginning of the
desired sector
Access time is the sum of:
Seek time
time it takes to position the head at the desired track (or
cylinder)
Rotational delay or rotational latency
time its takes for the beginning of the sector to reach the
head
Transfer time
Seek time >> Rotational Delay >> Transfer time

18 Chapter 11
19 Chapter 11
Tracks and
cylinders

20 Chapter 11
21 Chapter 11
Timing of a Disk I/O Transfer

22 Chapter 11
Disk Scheduling Policies

Seek time is the reason for differences in performance


Seek time >> Rotational latency
For a single disk there will be a number of I/O requests
If requests are selected randomly, we will not get a
good performance
we will assume that the requests for disk access of a
number of user will be random
(but for a single user `locality of reference will again hold)
So it is important to devise better methods:
I/O system sorts the requests in some way

23 Chapter 11
Evaluating the policies

To evaluate the policies, we will use a


random sequence of track accesses (see
book):
Starting at track 100 and then
55 58 39 18 90 160 150 38 184

and calculate how many track traversal


each policy will require to finish the
sequence

24 Chapter 11
55 58 39 18 90 160 150 38 184
FIFO policy: process requests in the order they arrive
From 100 to 55: 45 tracks traversed
From 55 to 58: 3 tracks traversed
From 58 to 39: 19 tracks traversed etc etc....
In total: 45+3+19... = 498 tracks
498 / 9 = 55.3 tracks traversed for the avg request

25 Chapter 11
The Shortest Service Time First policy (SSTF)
This policy looks each time at the queue of the waiting
requests and chooses the one that can be served with the
shortest seek from the current position.
From 100 to 90: 10 tracks
From 90 to 58: 32
From 58 to 55: 3
In total: 10+32+3... = 248 / 9 = 27.5 better!

55 58 39 18 90 160 150 38 184

90 58 55 39 38 18 150 160 184

26 Chapter 11
The SCAN (or elevator) policy
Problem with the previous policy: it is possible that some requests
will starve, because closer requests keep arriving!!
Solution: keep going in one direction until all requests are
satisfied. Then change direction, and so on
100 150 = 50; 150 160 = 10; 160 184 = 24; 184 90 = 94....
50+10+24+94+.... = 250 / 9 = 27.8 a bit worse than SSTF but no
starvation

55 58 39 18 90 160 150 38 184

27 Chapter 11
150 160 184 90 58 55 39 38 18
C-SCAN (Circular SCAN)

Similar behavior to SSTF


Problem with the previous policy:
nothing to do immediately after the arm
reverses direction (already done)
waiting requests will be at the other end

C-SCAN: assumes that return trip to track


is rapid (as it is in many drivers)
Disk is always scanned in one direction
only
When the scan is complete, arm goes back
28
to the beginning and restarts
Chapter 11
55 58 39 18 90 160 150 38 184
C-SCAN (Circular SCAN)
150 160 184 18 38 39 55 58 90
If the return home is considered as 184-18=166
then the average seek length is 35.8.
If it is considered 0, then 136 / 9 = 15 (only!)
In practice, it will be closer to 35 than to 15.

18

return home

184
29 Chapter 11
Last in, First Out (LIFO)

Serve always the most recent request first!


Rationale: keep serving the same user may
result in accessing nearby tracks
certainlytrue if file is sequential
applies the principle of locality to disk accesses

But may starve early users

30 Chapter 11
31 Chapter 11
In practice...

For a realistic evaluation of disk times, one


cannot assume simply that traversal of one
track takes one unit of time
One must consider real arm motion times,
which include a start time when the head
picks up speed
One must also consider rotational delay
and read times
Such times vary from disk unit to disk unit

32 Chapter 11
Important Concepts of Chapter 11

Different types of I/O Devices


Different types of I/O Processing
Direct Memory Access
Buffering
Characteristics of disk units
Access time
Different disk scheduling algorithms
comparison

33 Chapter 11

You might also like