Lecture 15- Characteristics of I/O Devices Flashcards
What are the Objectives of I/O System?
Efficiency
I/O devices are much slower than the processor
Should use I/O devices efficiently and avoid blocking CPU
Independence and uniformity
I/O devices are quite complex
User should not worry about the details of I/O devices
I/O system should allow the user to treat devices in a uniform way
User should deal with virtual devices rather than actual ones
Structure of I/O System
I/O system consists of several layers
Application program
May request an I/O in a high level language
Translated to system calls
I/O Control System: deal with I/O related system calls.
Device Driver: A software module that manages the communication with a special I/O device Converts logical I/O request into specific commands directed to the device.
Device controller:
A hardware unit attached to the I/O bus
Provides a hardware interface between computer and I/O device
I/O Device:
Block device transfers data in groups of characters
Character device transfers data one character a time
Each device has a device descriptor containing information that will be used by the I/O procedure:
The device identification;
The instructions that operate the device;
Character translation tables;
The current status;
The current user process (if any).
SEE IMAGE IN LECTURE
What is Repeated Data Input and Output?
If a process does repeated I/O then it will be repeatedly waiting for the I/O to complete, e.g., data input:
The process issues some system calls to read the first block of data
into a ‘working area’ in the memory
The process performs some processing on the data
This read-processing cycle has several problems:
The CPU is idle for most of the time, waiting for data transfer to finish
The total time is the sum of Ps and Ts
The disk unit is not running continuously
One way to improve efficiency is to use buffering
A buffer is an interim memory area that holds data in transit between user’s work area and a device:
Input buffering
Output buffering
SEE IMAGE IN LECTURE
What is Buffering?
Output buffering
Output data is transferred to an output buffer
The OS empties the buffer when it is full
The process is blocked only if it tries to output before the OS has emptied a full buffer
Input buffering Input data is stored in an input buffer The process takes data from this buffer The OS fills the buffer when it is empty A process is blocked if trying to input from an empty buffer
This smooths out peaks in I/O demands
What is Single Buffering?
Blocks of data are read into the buffer and then moved to the user’s work area
When a block is moved from the buffer, its processing can be in parallel with the reading of the next block
Double Buffering?
Use two buffers: the process writes (or reads) to one, while the OS empties (or fills) the other
One buffer can be emptied while the other is being filled
If the processing time is less than transferring time, transferring data may be continuous
This can be extended to multiple buffering
What is the summary?
I/O system separates users from the complexity of I/O devices
I/O system consists of: application program, I/O control system,
device driver, device controller, and I/O devices
Input and output buffering can be used to improve efficiency
We may further use double or multiple buffering techniques