Processing Techniques
There are 3 different techniques used by the processor for input output subsystem they are as follows;
Polled mode/programmed input output – This method is poor; it stops the CPU when it determines whether to read or write. It works within three modes and they are status, data and command. The operating will cycle through the states until the processes are complete. An example of this can be seen below;
Above we can see that the operating system must cycle through the differing registers until the correct response is received. The functions that the system will follow to complete the polled mode process can be seen below
- The host will repeatedly read the device until the busy status is cleared
- It will then send a write bit to the command register and put the data in to the data register
- Then the command bit will be issued in to the status register
- The device can see the command is ready and from here is sets the device to busy
- It is now enabled to perform the writing operation
It is when the above is complete that the cycle can begin again for a new set of instructions. More complex processors use the interrupt driven method and are capable of the following tasks;
- At the end of each instruction it checks for further interrupts that maybe pending
- It will save the programme counter
- Saves the processor status
- It can change the processors mode
- It will jump to the well known address
Interrupt Driven I/O – Data is entered form a keyboard and stored in the memory so the instruction is to write. This is then placed in to the instruction register but the actual data itself will be placed in the data register. The CPU will then receive this and send the data from the register to its desired destination. The instructions are stored in to the intermediate buffer. This allows the CPU to process other processes during transfer time.
Direct Memory Access – This wastes no CPU cycle. It will only interrupt at the end of the cycle.
Above we can see an example of the D.M.A. It is in this system that the least amount of interrupts occurs. At the top the data count, in here is stored the total size of the input or output data in bits or bytes. This is the accumulation of size from within the data register. Secondly is the Data register. Within the data register will be the exact contents of what is to be read or written. The address register is the actual memory location of the data to be read or written. Control logic is where the interrupts occur however it is only brief and this makes the system far more efficient.
Buffering
In the input output subsystem there is a need to buffer. There are several types of buffering. Buffering is used for one sole purpose; this is to manage the CPU speed.
As you can see there are three different types of buffering. They are single buffering, double buffering and circular buffering. A singular buffer is used store data between the input and output device and user process. There is a double buffer which has twice the holding capacity and a circle buffer which holds many more commands. This allows less CPU waiting which ensures a better and more efficient system. This form of CPU management can then be broken down into input output issues.
Caching: Caching is the form of fast memory holding copied of data (normally the data held in the data buffer). It can work with both read and write and it is key to input output performance.
Scheduling: Operating systems try to invoke fairness when switching between input and output properties. This is similar to the scheduling technique.
Spooling: Spooling is the form of control used by singular input/output devices. It can queue commands for example a printer, by storing them in the spooling area.
Error Handling: It has input output error checking properties; it can recover from a disk read error, when the device is unavailable and such possibilities. The system often records errors in a log on the operating system.
Device Reservation: It can use system calls for specific duties when needing exclusive access to a device.