Presentation is loading. Please wait.

Presentation is loading. Please wait.

Device Management Part 1: I/O System.

Similar presentations

Presentation on theme: "Device Management Part 1: I/O System."— Presentation transcript:

1 Device Management Part 1: I/O System

2 Functions of Device Management
Device management involves four basic 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.

3 Types of devices The system’s peripheral devices generally fall into one of three categories: Dedicated Shared Virtual The differences are a function of the characteristics of the devices, as well as how they’re managed by the Device Manager.

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

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

6 Virtual Devices A combination of the first two types They’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.

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

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

9 Components of the I/O Subsystem
The 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.

10 Components of the I/O Subsystem
Cab Driver Station wagon Van Driver Cab Phone calls Driver Van Dispatcher Cab Driver Minibus Station wagon Fig. 1. The mythical “McHoes and Flynn Taxicab Company” Driver Cab

11 Components of the I/O Subsystem
Disk 1 Disk 2 Disk 3 Control Unit 1 Channel 1 Control Unit 2 Tape 1 Tape 2 Tape 3 Tape 4 CPU Control Unit 3 Channel 2 Control Unit 4 Disk 4 Disk 5

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

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

14 Device Manager Must Know 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. Solved by structuring interaction between units Handled by “buffering” records & queueing requests

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

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

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

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

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

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

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

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

23 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 movement Minimize mean response time Minimize variance in response time

Download ppt "Device Management Part 1: I/O System."

Similar presentations

Ads by Google