Device Management
System Devices
Sequential Access StorageMedia
Direct Access StorageDevices
Components of I/OSubsystem
Communication AmongDevices
Management of I/ORequests
Paper Storage Media
Magnetic Tape Storage
Magnetic Disk Storage
Optical Disc Storage
1
Powered by DeSiaMore
Device Management Functions
Track status of each device (such as tape drives, diskdrives, printers, plotters, and terminals).
Use preset policies to determine which process will get adevice and for how long.
Allocate the devices.
Deallocate the devices at 2 levels:
At process level when I/O command has been executed & device istemporarily released
 At job level when job is finished & device is permanentlyreleased.
2
Powered by DeSiaMore
System Devices
Differences among system’s peripheral devices are afunction of characteristics of devices, and how well they’remanaged by the Device Manager.
Most important differences among devices
Speeds
Degree of sharability.
By minimizing variances among devices, a system’soverall efficiency can be dramatically improved.
3
Powered by DeSiaMore
Dedicated Devices
Assigned to only one job at a time and serve that job forentire time it’s active.
E.g., tape drives, printers, and plotters, demand thiskind of allocation scheme, because it would beawkward to share.
Disadvantage -- must be allocated to a single user forduration of a job’s execution.
Can be quite inefficient, especially when device isn’tused 100 % of time.
4
Powered by DeSiaMore
Shared Devices
Assigned to several processes.
E.g., disk pack (or other direct access storage device)can be shared by several processes at same time byinterleaving their requests.
Interleaving must be carefully controlled by DeviceManager.
All conflicts must be resolved based on predeterminedpolicies to decide which request will be handled first.
5
Powered by DeSiaMore
Virtual Devices
Combination of dedicated devices that have beentransformed into shared devices.
E.g, printers are converted into sharable devicesthrough a spooling program that reroutes all printrequests to a disk.
Output sent to printer for printing only when all of ajob’s output is complete and printer is ready to print outentire document.
Because disks are sharable devices, this technique canconvert one printer into several “virtual” printers, thusimproving both its performance and use.
6
Powered by DeSiaMore
Sequential Access Storage Media
Magnetic tape used for secondary storage on earlycomputer systems; now used for routine archiving &storing back-up data.
Records on magnetic tapes are stored serially, one afterother.
Each record can be of any length.
Length is usually determined by the application program.
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.
7
Powered by DeSiaMore
Magnetic Tapes
Data is recorded on 8 paralleltracks that run length of tape.
Ninth track holds parity bit usedfor routine error checking.
Number of characters that can berecorded per inch is determinedby density of tape (e.g., 1600 or6250 bpi).
8
Parity
Characters
Powered by DeSiaMore
Storing Records on Magnetic Tapes
Can store records individually or grouped into blocks.
If individually, each record is separated by a space to indicate itsstarting and ending places.
If blocks, then entire block is preceded by a space and followed bya space, but individual records are stored sequentially within block.
Interrecord gap (IRG) is gap between records about 1/2inch long regardless of the sizes of the records it separates.
Interblock gap  (IBG) the gap between blocks of records;still 1/2 inch long.
9
Powered by DeSiaMore
Pros & Cons of Blocking
Fewer I/O operations are needed because a single READcommand can move an entire block (physical record thatincludes several logical records) into main memory.
Less tape is wasted because size of physical recordexceeds size of gap.
Overhead and software routines are needed for blocking,deblocking, and record keeping.
Buffer space may be wasted if you need only one logicalrecord but must read an entire block to get it.
10
Powered by DeSiaMore
Transfer Rates & Speeds
Block size set to take advantage of transfer rate.
Transfer rate -- density of the tape, multiplied by the tapetransport speed (speed of the tape)
transfer rate = density * transport speed
If  transport speed is 200 inches per second, at 1600 bpi, atotal of 320,000 bytes can be transferred in one second,
Theoretically optimal size of a block is 320,000 bytes.
Buffer must be equivalent.
11
Powered by DeSiaMore
Magnetic Tape Access Times Vary Widely
BenchmarksAccess time
Maximum access 2.5 minutes
Average access 1.25 minutes
Sequential access 3 milliseconds
Variability makes magnetic tape a poor medium for routinesecondary storage except for files with very highsequential activity.
12
Powered by DeSiaMore
Direct Access Storage Devices (RandomAccess Storage Devices)
Direct access storage devices (DASDs)-- any devices thatcan 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.
Although variance in DASD access times isn’t as wide aswith magnetic tape, location of specific record still has adirect effect on amount of time required to access it.
13
Powered by DeSiaMore
Fixed-Head Drums
Magnetically recordable drums.
Resembles a giant coffee cancovered with magnetic film andformatted so the tracks runaround it.
Data is recorded serially oneach track by the read/writehead positioned over it.
Fixed-head drums were veryfast but also very expensive,and they did not hold as muchdata as other DASDs.
14
Powered by DeSiaMore
Fixed Head Disks
Fixed-head disks -- eachdisk looks like a phonographalbum.
Covered with magnetic filmthat has been formatted,usually on both sides, intoconcentric circles.
Each circle is a track. Datais recorded serially on eachtrack by the fixed read/writehead positioned over it.
One head for each track.
15
Rotation
Powered by DeSiaMore
Pros & 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 accommodatewidth of the read/write heads.
16
Powered by DeSiaMore
Movable-Head Drums and Disks
Movable-head drums have only a few read/write heads thatmove from track to track to cover entire surface of drum.
Least expensive device has only 1 read/write head for entire drum
More conventional design has several read/write heads that movetogether.
One read/write head that floats over the surface of the disk.
Disks can be individual units (used with many PCs) or partof a disk pack (a stack of disks).
17
Powered by DeSiaMore
Cylinders
It’s slower to fill a disk pack surface-by-surface than to fillit up track-by-track.
If fill Track 0 of all surfaces, got virtual cylinder of data.
Are as many cylinders as there are tracks.
Cylinders are as tall as the disk pack.
To access any given record, system needs:
Cylinder number, so arm can move read/write heads to it.
Surface number, so proper read/write head is activated.
Record number, so read/write head know when to begin reading orwriting.
18
Powered by DeSiaMore
Optical Disc Storage (CD-ROM)
Optical disc drives uses a laser beam to read and write tomulti-layered discs.
Optical disc drives work in a manner similar to a magneticdisk drive.
Head on an arm that moves forward and backward across the disc.
Uses a high-intensity laser beam to burn pits (indentations)and lands (flat areas) in disc to represent ones and zeros,respectively.
19
Powered by DeSiaMore
Concentric Tracks vs. Spiraling Tracks
Magnetic disk consists of concentric tracks of sectors andit spins at a constant speed (constant angular velocity).
Because sectors at outside of disk spin faster pastread/write head than inner sectors, outside sectors aremuch larger than sectors located near center of disk.
An optical disc consists of a single spiraling track of same-sized sectors running from center to rim of disc.
Allows many more sectors & much more data to fit onoptical disc compared to magnetic disk of same size.
20
Powered by DeSiaMore
Measures of Performancefor Optical Disc Drives
Sustained data-transfer rate -- speed at which massiveamounts of data can be read from disc.
Measured in bytes per second (such as Mbps).
Crucial for applications requiring sequential access.
Average access time -- average time required to movehead to a specific place on disc.
Expressed in milliseconds (ms).
Cache size -- hardware cache acts as a buffer bytransferring blocks of data from the disc
Anticipates user may want to reread some recently retrieved info.
 Act as read-ahead buffer, looking for next block of info on disc.
21
Powered by DeSiaMore
CD-ROM Technology
CD-ROM -- first commonly used optical storage DASD.
Stores very large databases, reference works, complexgames, large software packages, system documentation,and user training material.
CD-ROM jukeboxes (autochangers or libraries) arecapable of handling multiple discs and networked todistribute multimedia and reference works to distant user.
22
Powered by DeSiaMore
CD-Recordable Technology (CD-R)
CD-R drives record data on optical discs using a write-once technique.
WORM (write once, read many).
Only a finite amount of data can be recorded on each discand, once data is written, it can’t be erased or modified.
It has an extremely long shelf life.
23
Powered by DeSiaMore
CD-Rewritable Technology (CD-RW)
CD-RW drives can read a standard CD-ROM, CD-R andCD-RW discs.
CD-RW discs can be written and rewritten many times byfocusing a low-energy laser beam on surface, heatingmedia just enough to erase pits that store data and restoringrecordable media to its original state.
Useful for storing large quantities of data and for sound,graphics, and multimedia applications.
24
Powered by DeSiaMore
Digital Video Disc (DVD) Techonolgy
DVD uses infrared laser to read disc (holds equivalent of13 CD-ROM discs).
By using compression technologies, has more than enoughspace to hold a 2-hour of movie with enhanced audio.
Single layered DVDs can hold 4.7 GB
Double-layered disc can hold  8.5 GB on each side of the disc.DVDs are used to store music, movies, and multimediaapplications.
DVD-RAM is a writable technology that uses a red laserto read, modify, and write data to DVD discs.
25
Powered by DeSiaMore
Three Factors Contribute To TimeRequired To Access a File
Seek time  -- time required to position the read/write headon the proper track. (Doesn’t apply to devices with fixedread/write heads.)
Slowest of the three factors
Search time (rotational delay) -- time it takes to rotateDASD until requested record is under read/write head.
Transfer time --  when data is actually transferred fromsecondary storage to main memory.
Fastest.
26
Powered by DeSiaMore
Access Time For Fixed-Head Devices
Fixed-head devices can access a record by knowing itstrack number and record number.
Total amount of time required to access data depends on:
Rotational speed is constant within each device (although it variesfrom device to device)
Position of record relative to position of the read/write head.
search time (rotational delay)
+transfer time (data transfer)
access time
27
Powered by DeSiaMore
Example of Access Time ForFixed-Head Devices
How long will it take to access a record?
Typically, one complete revolution takes 16.8 ms, soaverage rotational delay is 8.4 ms.
Data transfer time varies from device to device, but atypical value is 0.00094 ms per byte
size of record dictates this value.
For example, it takes 0.094 ms (almost 0.1 ms) to transfera record with 100 bytes.
28
Powered by DeSiaMore
Access Time For Movable-Head Devices
Movable-head DASDs adds time required to move arminto position over the proper track (seek time).
seek time (arm movement)
search time (rotational delay)
+transfer time (data transfer)
access time
Seek time is the longest and several strategies have beendeveloped to minimize it.
29
Powered by DeSiaMore
Components of the I/O Subsystem
30
CPU
Channel 1
Control Unit 1
Channel 2
Control Unit 2
Control Unit 3
Control Unit 4
Disk 1
Disk 2
Disk 3
Tape 1
Tape 2
Tape 3
Tape 4
Disk 4
Disk 5
Powered by DeSiaMore
I/O Subsystem : I/O Channel
I/O Channel -- keeps up with I/O requests from CPU andpass them down the line to appropriate control unit.
Programmable units placed between CPU and control unit.
Synchronize fast speed of CPU with slow speed of the I/O device.
Make it possible to overlap I/O operations with processoroperations so the CPU and I/O can process concurrently.
Use channel programs that specifies action to beperformed by devices & controls transmission of databetween main memory & control units.
Entire path must be available when an I/O command isinitiated.
31
Powered by DeSiaMore
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, info passed from CPU tochannel:
I/O command (READ, WRITE, REWIND, etc.)
Channel number
Address of physical record to be transferred (from or to secondarystorage)
Starting address of a memory buffer from which or into whichrecord is to be transferred
32
Powered by DeSiaMore
Device Manager Must
Know which components are busyand which are free.
Be able to accommodate requeststhat come in during heavy I/O traffic.
Accommodate disparity of speedsbetween CPU and I/O devices.
33
Handled by “buffering”records & queueingrequests
Solved by structuringinteraction betweenunits
Powered by DeSiaMore
Communication Among Devices
Each unit in I/O subsystem can finish its operationindependently from others.
CPU is free to process data while I/O is being performed,which allows for concurrent processing and I/O.
Success of operation depends on system’s ability to knowwhen device has completed operation.
Uses a hardware flag that must be tested by CPU.
34
Powered by DeSiaMore
Hardware Flag Used To Communicate When ADevice Has Completed An Operation
Composed made up of three 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 containsinfo indicating status of channel.
Each bit is changed from zero to one to indicate that unithas changed from free to busy.
35
Powered by DeSiaMore
Testing the Flag : Polling or Interrupts
Polling uses a special machine instruction to test flag.
CPU periodically tests the channel status bit (in CSW).
Major disadvantage with this scheme is determining howoften the flag should be polled.
If polling is done too frequently, CPU wastes timetesting flag just to find out that channel is still busy.
If polling is done too seldom, channel could sit idle forlong periods of time.
36
Powered by DeSiaMore
Interrupts
Use of interrupts is a more efficient way to test flag.
Hardware mechanism does test as part of every machineinstruction executed by CPU.
If channel is busy flag is set so that execution of currentsequence of instructions is automatically interrupted.
Control is transferred to interrupt handler, which residesin a predefined location in memory.
Some sophisticated systems are equipped with hardwarethat can distinguish between several types of interrupts.
37
Powered by DeSiaMore
Direct Memory Access (DMA)
I/O technique that allows a control unit to access mainmemory directly.
Once reading or writing begins, remainder of data can betransferred to and from memory without CPU intervention.
To activate this process CPU sends enough info to controlunit to initiate transfer of data
Then CPU goes to another task while control unitcompletes transfer independently.
This mode of data transfer is used for high-speed devicessuch as disks.
38
Powered by DeSiaMore
Buffers
Buffers are temporary storage areas residing in convenientlocations throughout system: main memory, channels, andcontrol units.
Used extensively to better synchronize movement of databetween relatively slow I/O devices & very fast CPU.
Double buffering --2 buffers are present in main memory,channels, and control units.
While one record is being processed by CPU another can be reador written by channel
39
Powered by DeSiaMore
Management of I/O Requests
Device Manager divides task into 3 parts, with eachhandled by specific software component of I/O subsystem.
 
I/O traffic controller watches status of all devices, controlunits, and channels.
I/O scheduler implements policies that determineallocation of, and access to, devices, control units, andchannels.
I/O device handler performs actual transfer of data andprocesses the device interrupts.
40
Powered by DeSiaMore
I/O Traffic Controller
Monitors status of every device, control unit, and channel.
Becomes more complex as number of units in I/O subsystemincreases and as number of paths between these units increases.
Three main tasks: (1) it must determine if there’s at least 1path available; (2) if there’s more than 1 path available, itmust determine which to select; and (3) if paths are allbusy, it must determine when one will become available.
Maintains a database containing status and connections foreach unit in I/O subsystem, grouped into Channel ControlBlocks, Control Unit Control Blocks, and Device ControlBlocks.
41
Powered by DeSiaMore
Traffic Controller Maintains Database ForEach Unit In I/O Subsystem
42
Powered by DeSiaMore
I/O Scheduler
I/O scheduler performs same job as Process Scheduler-- itallocates the devices, control units, and channels.
Under heavy loads, when # requests > # available paths,I/O scheduler must decide which request satisfied first.
I/O requests are not preempted: once channel program hasstarted, it’s allowed to continue to completion even thoughI/O requests with higher priorities may have entered queue.
Feasible because programs are relatively short (50 to 100 ms).
43
Powered by DeSiaMore
I/O Scheduler - 2
Some systems allow I/O scheduler to give preferentialtreatment to I/O requests from “high-priority” programs.
If a process has high priority then its I/O requests alsohas high priority and is satisfied before other I/Orequests with lower priorities.
I/O scheduler must synchronize its work with trafficcontroller to make sure that a path is available to satisfyselected I/O requests.
44
Powered by DeSiaMore
I/O Device Handler
I/O device handler processes the I/O interrupts, handleserror conditions, and provides detailed schedulingalgorithms, which are extremely device dependent.
Each type of I/O device has own device handler algorithm.
first come first served (FCFS)
shortest seek time first (SSTF)
SCAN (including LOOK, N-Step SCAN, C-SCAN, and C-LOOK)
Every scheduling algorithm should :
Minimize arm movement
Minimize mean response time
Minimize variance in response time
45
Powered by DeSiaMore
First Come First Served (FCFS) DeviceScheduling Algorithm
Simplest device-scheduling algorithm:
Easy to program and essentially fair to users.
On average, it doesn’t meet any of the three goals of a seekstrategy.
Remember, seek time is most time-consuming of functionsperformed here, so any algorithm that can minimize it ispreferable to FCFS.
46
Powered by DeSiaMore
Shortest Seek Time First (SSTF) DeviceScheduling Algorithm
Uses same underlying philosophy as shortest job nextwhere shortest jobs are processed first & longer jobs  wait.
Request with track closest to one being served (that is, onewith shortest distance to travel) is next to be satisfied.
Minimizes overall seek time.
Favors easy-to-reach requests and postpones traveling tothose that are out of way.
47
Powered by DeSiaMore
SCAN  Device Scheduling Algorithm
SCAN uses a directional bit to indicate whether the arm ismoving toward the center of the disk or away from it.
Algorithm moves arm methodically from outer to innertrack servicing every request in its path.
When it reaches innermost track it reverses direction andmoves toward outer tracks, again servicing every requestin its path.
48
Powered by DeSiaMore
LOOK (Elevator Algorithm) : A Variationof SCAN
Arm doesn’t necessarily go all the way to either edgeunless there are requests there.
“Looks” ahead for a request before going to service it.
Eliminates possibility of indefinite postponement ofrequests in out-of-the-way places—at either edge of disk.
As requests arrive each is incorporated in its proper placein queue and serviced when the arm reaches that track.
49
Powered by DeSiaMore
Other Variations of SCAN
N-Step SCAN -- holds all requests until arm starts on wayback. New requests are grouped together for next sweep.
C-SCAN (Circular SCAN) -- arm picks up requests on itspath during inward sweep.
When innermost track has been reached returns to outermost trackand starts servicing requests that arrived during last inward sweep.
Provides a more uniform wait time.
C-LOOK (optimization of C-SCAN) --sweep inward stopsat last high-numbered track request, so arm doesn’t moveall the way to last track unless it’s required to do so.
 Arm doesn’t necessarily return to the lowest-numbered track; itreturns only to the lowest-numbered track that’s requested.
50
Powered by DeSiaMore
Which Device Scheduling Algorithm?
FCFS works well with light loads, but as soon as loadgrows, service time becomes unacceptably long.
SSTF is quite popular and intuitively appealing. It workswell with moderate loads but has problem of localizationunder heavy loads.
SCAN works well with light to moderate loads andeliminates problem of indefinite postponement. SCAN issimilar to SSTF in throughput and mean service times.
C-SCAN works well with moderate to heavy loads and hasa very small variance in service times.
51
Powered by DeSiaMore
Search Strategies: Rotational Ordering
Rotational ordering -- optimizes search times by orderingrequests once read/write heads have been positioned.
Nothing can be done to improve time spent movingread/write head because it’s dependent on hardware.
Amount of time wasted due to rotational delay can bereduced.
If requests are ordered within each track so that firstsector requested on second track is next number higherthan one just served, rotational delay is minimized.
52
Powered by DeSiaMore
53
Powered by DeSiaMore
Redundant Array of Inexpensive Disks(RAID)
RAID is a set of physical disk drives that is viewed as asingle logical unit by OS.
RAID assumes several smaller-capacity disk drivespreferable to few large-capacity disk drives because, bydistributing data among several smaller disks, system cansimultaneously access requested data from multiple drives.
System shows improved I/O performance and improveddata recovery in event of disk failure.
54
Powered by DeSiaMore
RAID -2
RAID introduces much-needed concept of redundancy tohelp systems recover from hardware failure.
Also requires more disk drives which increase hardwarecosts.
55
Powered by DeSiaMore
Six standard levels of RAID fall into 4 categories.  Eachoffers a unique combination of advantages.
56
Powered by DeSiaMore
Terminology
access time
blocking
buffers
Channel Status Word (CSW)
cylinder
dedicated device
direct access storage devices(DASDs)
direct memory access (DMA)
first come first served (FCFS)
I/O channel
I/O control unit
I/O device handler
I/O scheduler
I/O subsystem
I/O traffic controller
interblock gap (IBG)
interrecord gap (IRG)
interrupts
LOOK
magnetic tape
optical disc drive
polling
RAID
57
Powered by DeSiaMore
Terminology - 2
rotational ordering
SCAN
search strategy
search time
seek strategy
seek time
sequential access media
shared device
shortest seek time first (SSTF)
transfer rate
transfer time
transport speed
virtual device
58
Powered by DeSiaMore