Sunteți pe pagina 1din 40

Chapter 2 Device Management

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 systems peripheral devices are a function of characteristics of devices, and how well theyre managed by the Device Manager. Most important differences among devices Speeds Degree of sharability. By minimizing variances among devices, a systems overall efficiency can be dramatically improved.

Sequential Access Storage Media Magnetic tape used for secondary storage on early computer systems; now used for routine archiving & storing back-up data. Records on magnetic tapes 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 & fastforwarded 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 (e.g., 1600 or 6250 bpi).

Storing Records on Magnetic Tapes Can store records individually or grouped into blocks. If individually, each record is separated by a space to indicate its starting and ending places. Records are stored sequentially within block. 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.

Interblock gap (IBG) the gap between blocks of records; still 1/2 inch long.

IBG

Record 1
IRG

Record 1

1 BLOCK OF 6 RECORDS

Record 4 Record 6

Record 2
IRG

IBG

Record 7
IRG 1 BLOCK OF 6 RECORDS

Record 3 Record 9 Record 11

Record 4

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 Maximum access Average access Sequential access Access time 2.5 minutes 1.25 minutes 3 milliseconds

Variability makes 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) Direct 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.

Fixed-head disks -- each disk looks like a phonograph album.


Rotation

Covered with magnetic film that has been formatted, usually on both sides, into concentric circles. Each circle is a track. Data is recorded serially on each track by he fixed read/write head positioned over it. One head for each track.

Pros and Cons of Fixed Head Disks Very fastfaster 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.

Example of DASD with movable 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). Although variance in DASD access times isnt as wide as with magnetic tape, location of specific record still has a direct effect on amount of time required to access it.

Example of DASD with movable read/write heads.

Optical Disc Storage (CD-ROM) Optical disc drives uses a laser beam to read and write to multi-layered discs. Optical disc drives work in a manner similar to a magnetic disk 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.

Three Factors Contribute To Time Required To Access a File Seek time (slowest of the three factors) Time required to position the read/write head on the proper track. (Doesnt apply to devices with fixed read/write heads.) Search time (rotational delay) Time it takes to rotate DASD until requested record is under read/write head. Transfer time (fastest of the three factors) When data is actually transferred from secondary storage to main memory.

Components of the I/O Subsystem


Control Unit 1 Channel 1 Control Unit 2 Disk 1 Disk 2 Disk 3 Tape 1 CPU Tape 2 Control Unit 3 Channel 2 Control Unit 4 Disk 4 Disk 5 Tape 3 Tape 4

2.6.2 Channel Architecture


CPU Memory

Channel Paths

Channel Subsystem

Control Unit

Control Unit

Control Unit

Device 1

Device 2

Device 3

Device 4

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. 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 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

Device Manager Must


Know which components

Solved by structuring interaction between units

are busy and which are free.


Be able to accommodate

requests that come in during heavy I/O traffic.


Accommodate disparity of

Handled by buffering records & queueing requests

speeds between CPU and I/O devices.

Communication Among Devices For the device manager to keep running efficiently under the demanding conditions of a busy computer system, three problems must be resolved: It needs to know which components are busy and which are free. It must be able to accommodate the requests that come in during heavy I/O traffic. It must accommodate the disparity of speeds between the CPU and the I/O devices.

Hardware Flag Used To Communicate When A Device Has Completed An Operation Hardware flag is 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 contains info indicating status of channel. Each bit is changed from zero to one to indicate that unit has changed from free to busy.

Testing the Flag : 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

Polling the I/O module performs the requested action and then sets the appropriate bits in the I/O status register but take no further action to alert the processor. does not interrupt the processor the processor periodically checks the status of the I/O module until it finds that the operation is complete

Interrupts Mechanism Use of interrupts is a more efficient way to test flag. Hardware mechanism does test as part of every machine instruction executed by CPU. If channel is busy flag is set so that execution of current sequence of instructions is automatically interrupted. Control is transferred to interrupt handler, which resides in a predefined location in memory. Some sophisticated systems are equipped with hardware that can distinguish between several types of interrupts.

Interrupts Almost all computers provide a mechanism by which other components may interrupt the normal processing of the CPU.
Classes on interrupts Program (virus, X/0) I/O Hardware Timer (Printer, Disk) failure (System Clock) & End of the events

Beginning of the events

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.

2.5 Without (DMA)


Memory I/O Module I/O Devices

CPU

I/O Instructions

Direct Memory Access (DMA)


CPU Memory I/O Module I/O Devices

I/O Instructions More jobs can be done (Multi-tasking) But Slowing down the CPU execution (DMA controller steals the memory cycle) Useful on devices like disks (e.g. Multimedia Downloading files to local drive, printing events)

Three techniques are possible for I/O operations: a) Polling (Programmed I/O) b) Interrupt-Driven I/O c) Direct Memory Access (DMA)

Buffers Buffers are temporary storage areas residing in convenient locations throughout system: main memory, channels, and control units. Used extensively to better synchronize movement of data between 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 read or written by channel

reading CPU Buffer 1 Buffer 2 writing Disk

Buffer 1 CPU reading writing Buffer 2 Disk

Management of I/O Requests Device Manager divides task into 3 parts, with each handled by specific software component of I/O subsystem. I/O traffic controller watches status of all devices, control units, and channels. I/O scheduler implements policies that determine allocation of, and access to, devices, control units, and channels. I/O device handler performs actual transfer of data and processes the device interrupts.

I/O Modules
User Program

I/O Module

I/O

User Program I/O Module I/O User Program

Interrupt handling
OS preserves the state of the CPU by storing Registers and the Program Counter (PC) Control is transferred to the ISR, generally through the interrupt vector, After the interrupt is serviced, the saved return address is loaded into the PC and the interrupted computation resumes.

An interrupt service routine (ISR) is provided that is responsible for dealing with the interrupt.

0000 Interrupt XY

2317

Interrupt Vector Area

2317

ISR

Magnetic Tapes
Parity

Characters

S-ar putea să vă placă și