0% found this document useful (0 votes)
2 views

Chapter 4 Device Management (Updated)

Uploaded by

black hello
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Chapter 4 Device Management (Updated)

Uploaded by

black hello
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 38

Chapter 4

Device Management
Chapter 4 Overview
• The Device Manager
• Types of Devices
• Storage Media: Sequential Access and Direct
Access
• Components of the I/O Subsystem
• Communication Among Devices

小飞守角制作
Device Management Functions
• Track status of each device (such as
tape drives, disk drives, printers,
plotters, and terminals).
• Use preset policies to determine which
process will get a device and for how
long.
• Allocate the devices.
• Deallocate the devices at 2 levels:
• At process level when I/O command has been
executed & device is temporarily released
• At job level when job is finished & device is
permanently released. 小飞守角制作
System
Devices
• Differences among system’s peripheral devices
are a function of characteristics of devices, and
how well they’re managed by the Device
Manager.
• Most important differences among devices
• Speeds
• Degree of sharability.
• By minimizing variances among devices, a
system’s overall efficiency can be dramatically
improved.
Dedicated devices (Non-sharable
devices)
• Devices are assigned to only one job at a
time; they serve that job for the entire
time it’s active or until it releases them.
Some devices, such as tape drives,
printers, and plotters.
• The disadvantage of dedicated devices is
that they must be allocated to a single
user for the duration of a job’s execution,
which can be quite inefficient, especially
when the device isn’t used 100 percent of
the time.
• And some devices can be shared or
Shared devices
• It can be assigned to several
processes. For instance, a disk, or any
other direct access storage device
(often shortened to DASD), can be
shared by several processes at the
same time by interleaving their
requests, but this interleaving must be
carefully controlled by the Device
Manager.
• All conflicts—such as when Process A
and Process B each need to read from
the same disk—must be resolved
based on predetermined policies to
decide which request will be handled
Sequential Access Storage Media
• Magnetic tape used for secondary storage on
early computer systems; now used for routine
archiving & storing back-up data.
• Records are stored serially, one after other.
• Each record can be identified by its position on
the tape.
• To access a single record, tape is mounted &
“fast-forwarded” from its beginning until locate
desired position.
Magnetic Tapes
• Data is recorded on 8 parallel tracks
that run length of tape.
• Ninth track holds parity bit used for
routine error checking.
• Number of characters that can be
recorded per inch is determined by
density of tape
• Density
BPI🡺 Bits Per Inch. Capacity
Length
1600 BPI 2400 ft 40 MB
6250 BPI 2400 ft 170 MB.
8 data bits which make one byte (or character)
and the 9th bit for parity.
Density Length Capacity
1600 BPI 2400 ft 40 MB
6250 BPI 2400 ft 170 MB.

• 1600 BPI = 8 bits = 1 byte = reserve 1


bit for parity
• 1600 / 9-bit = 178 bytes * 2400 ft =
Storing Records on Magnetic Tapes
• Can store records individually or
grouped into blocks.
• Interrecord gap (IRG) is gap between
records about 1/2 inch long regardless
of the sizes of the records it separates.
Prevent one set from overwriting the
other. Used as a marker for the end of
data.
• 1000 records * 0.5 inch - wasted

• Interblock gap (IBG) the gap between


blocks of records; still 1/2 inch long. (10
records in a block)
Pros and Cons of Blocking
• Advantages
• Fewer I/O operations are needed because a single
READ command can move an entire block (physical
record that includes several logical records) into
main memory.
• Less tape is wasted because size of physical
record exceeds size of gap.

• Disadvantages
• Overhead and software routines are needed for
blocking, deblocking, and record keeping.
• Buffer space may be wasted if you need only one
logical record but must read an entire block to get
it.
Magnetic Tape Access Times Vary
Widely
• Benchmarks Access time

• Maximum access 2.5 minutes


• Average access 1.25 minutes

• Sequential access 3
Variability makes
milliseconds
magnetic tape a poor
medium for routine
secondary storage
except for files with very
high sequential activity.
Direct Access Storage Devices
(Random Access Storage Devices)
DASDs-- any devices that can directly read or
write to a specific place on a disk.

Two major categories:


• DASD with fixed read/write heads
• DASD with movable read/write heads.
• i.e. Optical Discs / Magnetic Disks
Fixed-head disks
• Covered with magnetic film These devices have been used when
that has been formatted, speed is of the utmost importance,
usually on both sides, into such as space flight or aircraft
concentric circles. applications

• Each circle is a track. Data is


recorded serially on each
track by the fixed read/write
head positioned over it.

• One head for each track.


Pros and Cons of Fixed Head Disks
• Very fast—faster than movable-head disks.

• High cost.

• Reduced storage space compared to a


moveable-head disk because tracks must be
positioned farther apart to accommodate width
of the read/write heads.
Movable-Head Drums and Disks

• Movable-head drums have only a few


read/write heads that move from track to
track to cover entire surface of drum.
• One read/write head that floats over the
surface of the disk.
• Disks can be individual units (used with many
PCs) or part of a disk pack (a stack of disks).
Factors Contribute To Time Required
To Access a File
•Seek time (slowest of the three factors)
• Time moving head to correct track
•Search time (rotational delay)
• Time it takes to rotate DASD until
requested record is under read/write
head. (Waiting for data to rotate under head )
•Transfer time (fastest of the three
factors)
• When data is actually transferred
from secondary storage to main
memory.
Factors Contribute To Time Required
To Access a File
Device Handler Seek Strategies
∙ A seek strategy for the I/O device
handler is the predetermined policy
that the device handler uses to
allocate access to the device among
the many processes that may be
waiting for it.
∙ It determines the order in which the
processes get the device and the goal
is to keep seek time to a minimum.
∙ Commonly used seek strategies: FCFS,
SSTF, SCAN, LOOK,etc.
Disk Scheduling Algorithms

Objective: Minimize seek time.

The disk may often have several pending disk


requests in the disk queue.

When one request is completed the O/S chooses


which pending request to service next

A number of different algorithms exist: FCFS,


SSTF, SCAN, C-SCAN, LOOK, C-LOOK
Suppose a 2.5 “ SATA hard disk drive has
3000 cylinders, numbered 0-2999.The
drive is currently serving an I/O request at
cylinder 151. The queue of pending
requests is as follows:
Time 5 7 16 35 40 47 55 60
Cylinde 87 35 1873 245 2653 890 200 478
r

Assumption : The head was previously


serving a request at cylinder 5.
(FCFS & SSTF algoritms do not require
previously
serving cylinder number)
(SCAN & LOOk algoritms do require
previously
serving cylinder number)
(i) FCFS
Suppose a 2.5 “ SATA hard disk drive has 3000 cylinders,
numbered 0-2999.The drive is currently serving an I/O request at
cylinder 151. The queue of pending requests is as follows:

Time 5 7 16 35 40 47 55 60
Cylinder 87 35 1873 245 2653 890 200 478

0 3 8 15 20 24 47 89 187 265 299


5 76 1 0 5 8 0 3 3 9

5 4 183
2 162 8
8 240
8
69 176
0
27 3
Total Head Movements =
8 8721
(ii) SSTF (Shortest Seek Time
First)
Suppose a 2.5 “ SATA hard disk drive has 3000 cylinders,
numbered 0-2999.The drive is currently serving an I/O request at
cylinder 151. The queue of pending requests is as follows:

Time 5 7 16 35 40 47 55 60
Cylinder 87 35 1873 245 2653 890 200 478

0 3 8 15 20 24 47 89 187 265 299


5 7 1 0 5 8 0 3 3 9
4 4
5 915 5
2 8 44
41
3 98
2 78
3
0
Total Head
Movements = 2922
– SCAN Algorithm
– The disk arm starts at one end of the disk,
and moves towards the other end, servicing
request as it reaches each cylinder, until it
gets to the other end of the disk.
– At the other end, the direction of the arm
movement is reversed and servicing
continues.
– If a request arrive in the queue just in front
of the head, it will be serviced almost
immediately; a request arriving just behind
the head will have to wait until the arm
moves to the end of the disk, reverses
direction and return.
(iii) Scan
Suppose a 2.5 “ SATA hard disk drive has 3000 cylinders,
numbered 0-2999.The drive is currently serving an I/O request
at cylinder 151. The queue of pending requests is as follows:
Assumption : The head was previously serving a request at
cylinder 5.
Time 5 7 16 35 40 47 55 60
Cylinder 87 35 1873 245 2653 890 200 478

0 3 8 15 20 24 47 89 187 265 299


5 7 1 0 5 8 0 3 3 9
4
4 23
9 41 78
5 3
2 98 0
3 34
291 6
5
2
2
Total Head Movements =
5812
(iv) Look
Suppose a 2.5 “ SATA hard disk drive has 3000 cylinders,
numbered 0-2999.The drive is currently serving an I/O request
at cylinder 151. The queue of pending requests is as follows:
Assumption : The head was previously serving a request at
cylinder 5.
Time 5 7 16 35 40 47 55 60
Cylinder 87 35 1873 245 2653 890 200 478

0 3 8 15 20 24 47 89 187 265 299


5 7 1 0 5 8 0 3 3 9
4
9 4 23 78
5 41
3 98 0
2
3
5 256
2 6
Total Head Movements
= 5120
Components of the I/O Subsystem
Entire path must be available when an I/O command is
initiated. Control Unit 1
Disk 1

Disk 2
Channel 1

Control Unit 2 Disk 3

Tape 1
CPU
Tape 2

Control Unit 3 Tape 3

Channel 2 Tape 4

Control Unit 4
Disk 4

Disk 5
I/O Subsystem : I/O Channel
• I/O Channel -- keeps up with I/O requests
from CPU and pass them down the line to
appropriate control unit.
• Synchronize fast speed of CPU with slow
speed of the I/O device.
• Make it possible to overlap I/O operations with
processor operations so the CPU and I/O can
process concurrently.
• Use channel programs that specifies action
to be performed by devices & controls
transmission of data between main memory &
control units.
I/O Subsystem : I/O Control Unit
• I/O control unit interprets signal sent by
channel.
• One signal for each function.

• At start of I/O command, information is


passed from CPU to channel:
■I/O command (READ, WRITE, REWIND,
etc.)
■Channel number
■Address of physical record to be transferred
(from or to secondary storage)
■Starting address of a memory buffer from
which or into which record is to be transferred
Communication Among Devices
Device Manager Must
• Know which components are
Solved by busy and which are free.
structuring
interaction • Be able to accommodate
between units requests that come in during
heavy I/O traffic.
Handled by
• Accommodate disparity of
“buffering”
speeds between CPU and I/O
records &
devices.
queueing
requests
Hardware Flag
• Used to communicate when a device has completed an
operation
• Hardware flag is made up of 3 bits.
• Each bit represents a component of I/O
subsystem.
• One each for channel, control unit, and device.
• Resides in the Channel Status Word (CSW)
• In a predefined location in main memory and
contains info indicating status of channel.
• Each bit is changed from zero to one to indicate that
unit has changed from free to busy.
Three techniques are
possible for I/O operations:
Polling
• Polling uses a special machine instruction to
test flag.
• CPU periodically tests the channel status
bit (in CSW).
• If polling is done too frequently, CPU wastes
time testing flag just to find out that channel is
still busy.
• If polling is done too seldom, channel could sit
idle for long periods of time
Interrupts
• Use of interrupts is a more efficient way to test flag.
• Overcomes the processor having to wait long periods
of time for I/O modules
• The processor does not have to repeatedly check the
I/O module status
• Hardware mechanism does test as part of every
machine instruction executed by CPU.
• If channel is busy flag is set , execution of current
sequence of instructions is automatically
interrupted.
• Control is transferred to interrupt handler, which
resides in a predefined location in memory.
Direct Memory Access (DMA)
• I/O technique that allows a control unit to
access main memory directly.
• Once reading or writing begins, remainder of
data can be transferred to and from memory
without CPU intervention.
• To activate this process CPU sends enough
info to control unit to initiate transfer of data
• Then CPU goes to another task while control
unit completes transfer independently.
• This mode of data transfer is used for high-
speed devices such as disks.
Direct Memory Access (DMA)

Memory I/O I/O Devices


CPU Module

I/O Instructions

More jobs can be done (Multi-tasking)


Useful on devices like disks (e.g. Multimedia Downloading
files to local drive, printing events)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy