A computer system comprises of Peripheral Devices apart from the basic CPU. These peripheral devices are usually the input/output devices, like printers, drives, tapes, card readers etc. These devices also have to be managed by the Operating System, it should activate them, control them, issue commands to the devices, handle errors etc., it should also provide an interface between the devices and the system, sp that it becomes easy to use these devices.
As these devices are quite different from each other, the operating system should provide for an environment which will interact will these devices, so that the user does not face any problems while working with various devices. If we look at the data which is represented, it may be in many different forms depending upon the type of I/O Device. For example, the data can be represented in ASCII, EBCDIC etc. The devices can be either shareable or non-shamble which have to be managed by the operating system.
Define Meaning of Input/output Devices
We can divide these input devices into two categories:
Block Devices and Character Devices
Block Devices: These are the devices, which store data in the form of blocks which are fixed in size and each block has its own address. In general the block size can vary between 128 bytes and 1024 bytes. These devices are capable to read every block of data independently. Disk Drives are good example of block Devices.
Character Devices: This type of I/O devices stores the data as streams of characters and they are read and transferred as streams of characters, without any block structure being followed. It usually does not have Addressing Mechanism. Monitors, line printers, punched cards etc are some of the examples of character devices.
If we look at this classification scheme, we will understand that is not perfect as there are same devices which cannot be fitted into these classifications. For example, Clocks Memory Mapped Screens etc cannot be classified under this category, but still in general this classification scheme holds good.
Software Component of I/O devices
Interrupt Handles, Devices Drivers, Device Independent Software, User level software
Interrupt Handles: It is that part of the software which is used to handle interrupts that occurs which any I/O Operation is in progress. These interrupts should be hidden away from the users as well as the system, so that they do not interface into any further operations.
Device Drivers: Any I/O device software has two basic classifications, one is device dependent and other is device independent. All the device dependent software is unique for each device. Device drivers are the Device Dependent Software, which are used to work with the devices concerned. Example of device drivers can be the drivers which are used for printers, modems etc.
Device-Independent Software: we have already seen that I/O software is divided into two categories which are device dependent and device independent. Most part of the software is device independent, which is used to carry on Various Input-Output Functions which are common to all the devices, so that a uniform interface is provided to users. The basic functions of this device independent input-output software are:
Providing a uniform interface for the device drivers, naming various I/O devices, allocating of Storage Space on the Block Devices, Error reporting, protection of the devices.
User level Software: This is a collection of library procedures which are linked to the user programs, which can be used to carry out any specific functions. These are basically used for taking the input and giving the output. These library procedures are to assist users in carrying out the various I-O Operations.
As we have already seen that the processing speed of CPU is faster than the speed of I/O Device Operations. Therefore, when we need to have an interactive program, which needs input gives output periodically, which it is being executed by CPU. The CPU has to wait in order to get input/provide output, for reducing or removing the CPU idle time different techniques are used, thereby increasing the productivity as well reducing the time required for execution of a program.
The following are the popular methods used:
Define Buffering and Spooling Briefly
Buffering: This is one of the methods which are used for simultaneous input, output and processing of a Single Process/Program. The philosophy here is very easy and simple, which says that without waiting for the time to come for inputting, once one input instruction is given, the second input instruction is processed, so that the CPU s well as the input device are both busy. The same thing can be used for the Output Instruction Processing.
This is achieved by instructing the input device to begin the next input data, once the data is read and CPU is about the start the processing, so that by the time CPU is ready to take next input, it is ready so that it can be processed. Thus the CPU as well as input device is busy. For the output, the CPU puts the output in the Buffer till the Output Device completes its ongoing job, once its finishes the current job, the data is ready for the output. Thus the Buffering can really enhance the co-ordination of CPU and input/output devices, which helps in adjust the speed differences between the CPU and Input/output Devices.
Spooling (Simultaneous Peripheral Operation on Line)
This method is also similar to the buffering but slightly more sophisticated. For spooling method the disk should have a very large buffer space as the data is read and stored in this buffer, the basic Difference Between Buffering and Spooling is that the buffering overlaps the input, output as well as the processing while the execution of a single program where as spooling allows the CPU to overlap computation, output of one job and simultaneously carry on the input for another job.
This Spooling is Advantageous and Superior than buffering as it is capable of handling input/output operations for different jobs at the same instance of time.
Thus the device management is done by the operating system, so that the user is not much bothered about the I/O operations.