Top Banner
Device Management Part 1: I/O System
23

Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Mar 30, 2015

Download

Documents

Rianna Hady
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Device ManagementPart 1: I/O System

Page 2: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Functions of Device Management

Device management involves four basic functions:1. Track status of each device (such as tape drives,

disk drives, printers, plotters, and terminals).

2. Use preset policies to determine which process will get a device and for how long.

3. Allocate the devices.

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

Page 3: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Types of devices

The system’s peripheral devices generally fall into one of three categories:DedicatedSharedVirtual

The differences are a function of the characteristics of the devices, as well as how they’re managed by the Device Manager.

Page 4: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Dedicated Devices

Are assigned to only one job at a time.They serve that job for the entire time the job is active or until it

releases them.Some devices demand this kind of allocation scheme, because it

would be awkward to let several users share them. Example: tape drives, printers, and plotters

DisadvantagesThey must be allocated to a single user for the duration of a

job’s execution, which can be quite inefficient, even though the device is not used 100% of the time.

Page 5: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Shared Devices

Can be assigned to several processes.

For example – a disk (DASD) can be shared by several processes at the same time by interleaving their requests;This interleaving must be carefully controlled by the Device

Manager

All conflicts must be resolved based on predetermined policies.

Page 6: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Virtual Devices

A combination of the first two typesThey’re dedicated devices that have been transformed into

shared devices.Example: printer

Converted into a shareable device through a spooling program that reroutes all print requests to a disk.

Only when all of a job’s output is complete, and the printer is ready to print out the entire document, is the output sent to the printer for printing.

Because disks are shareable devices, this technique can convert one printer into several virtual printers, thus improving both its performance and use.

Page 7: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Example: universal serial bus (USB)Acts as an interface between the OS, device drivers, and

applications and the devices that are attached via the USB host.One USB host (assisted by USB hubs) can accommodate up to

127 different devices.Each device is identified by the USB host controller with a unique

identification number, which allows many devices to exchange data with the computer using the same USB connection.

The USB controller assigns bandwidth to each device depending on its priority:

Highest priority is assigned to real-time exchanges where no interruption in the data flow is allowed such as video or sound data.

Medium priority is assigned to devices that can allow occasional interrupts without jeopardizing the use of the device, such as a keyboard or joystick.

Lowest priority is assigned to bulk transfers or exchanges that can accommodate slower data flow, such as printers or scanners.

Page 8: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Every device is different. Regardless of the specific attributes of the device, the most important differences among them are speed and degree of sharability.

Page 9: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Components of the I/O SubsystemThe pieces of the I.O subsystem all have to work harmoniously and it

works in a manner similar to the mythical “McHoes and Flynn Taxicab Company” shown in Fig.1.

Many requests come in from all over the city to the taxi company dispatcher.

It’s the dispatcher’s job to handle the incoming calls as fast as they arrive and to find out who needs transportation, where they are, where they are going and when.

The dispatcher then organizes calls into an order that will use the company’s resources as efficiently as possible.

It’s not easy as the company has several drivers and a variety of vehicles at its disposal: ordinary taxicabs, station wagons, vans and a minibus.

Once the order is set, the dispatcher calls the drivers who ideally jump into the appropriate vehicles, pick up the waiting passengers and deliver them quickly to their respective destinations.

Page 10: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Components of the I/O Subsystem

Dispatcher

Driver

Driver

Driver

Driver

Driver

Cab

Cab

Station wagon

Minibus

Cab

Van

Cab

Station wagon

Van

Phone calls

Fig. 1. The mythical “McHoes and Flynn Taxicab Company”

Page 11: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Components of the I/O Subsystem

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

Page 12: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

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.Entire path must be available when an I/O command is initiated.

Page 13: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

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 to channel:I/O command (READ, WRITE, REWIND, etc.)Channel numberAddress 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

Page 14: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Device Manager MustKnow which components are busy and

which are free.

Be able to accommodate requests that come in during heavy I/O traffic.

Accommodate disparity of speeds between CPU and I/O devices.

Handled by “buffering” records &

queueing requests

Solved by structuring interaction

between units

Page 15: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Communication Among Devices

Each unit in I/O subsystem can finish its operation independently 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 know when device has completed operation. Uses a hardware flag that must be tested by CPU.

Page 16: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Hardware Flag Used To Communicate When A Device Has Completed An OperationComposed 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.

Page 17: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Testing the Flag : Polling or InterruptsPolling

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 how often the flag should be polled. 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.

Page 18: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Interrupts

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.

Page 19: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

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.

Page 20: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

I/O Traffic Controller

Monitors status of every device, control unit, and channel. Becomes more complex as number of units in I/O subsystem

increases and as number of paths between these units increases. Three main tasks: (1) it must determine if there’s at least 1 path

available; (2) if there’s more than 1 path available, it must determine which to select; and (3) if paths are all busy, it must determine when one will become available.

Maintains a database containing status and connections for each unit in I/O subsystem, grouped into Channel Control Blocks, Control Unit Control Blocks, and Device Control Blocks.

Page 21: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

Traffic Controller Maintains Database For Each Unit In I/O Subsystem

Channel Control Block Control Unit ControlBlock

Device Control Block

Channel identificationstatus

Control UnitIdentification status

Device identificationstatus

List of control unitsconnected to it

List of channelsconnected to it

List of control unitsconnected to it

List of processeswaiting for it

List of devicesconnected to it

List of processeswaiting for it

List of processeswaiting for it

Page 22: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

I/O Scheduler

I/O scheduler performs same job as Process Scheduler-- it allocates 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 has started, it’s allowed to continue to completion even though I/O requests with higher priorities may have entered queue.

Some systems allow I/O scheduler to give preferential treatment to I/O requests from “high-priority” programs. If a process has high priority then its I/O requests also has high priority and is

satisfied before other I/O requests with lower priorities.

I/O scheduler must synchronize its work with traffic controller to make sure that a path is available to satisfy selected I/O requests.

Page 23: Part 1: I/O System. Functions of Device Management Device management involves four basic functions: 1. Track status of each device (such as tape drives,

I/O Device Handler

I/O device handler processes the I/O interrupts, handles error conditions, and provides detailed scheduling algorithms, 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 movementMinimize mean response timeMinimize variance in response time