Definition
IO Functions
IO functions are the mechanisms used to control the transfer of data between the processor and peripheral devices. These mechanisms range from high processor involvement to complete autonomy.
Functions
Programmed IO
The processor issues an IO command on behalf of a process and then waits in a busy-waiting loop for the operation to complete.
- Overhead: High CPU utilisation during the wait.
- Usage: Only suitable for very fast devices or embedded systems without complex interrupt support.
Interrupt-driven IO
The processor issues an IO command and then continues with other useful work (or switches to another process). The IO module interrupts the processor once the data transfer is complete.
- Efficiency: Better than programmed IO because the processor is not idle.
- Bottleneck: For large block transfers, the processor must still handle an interrupt for every word or byte transferred, which is inefficient.
Direct Memory Access (DMA)
The processor delegates the task of data transfer to a DMA Controller.
- Mechanism: The CPU provides the controller with the starting memory address, the device address, and the amount of data to transfer. The DMA module then copies data autonomously between the device and main memory.
- Preemption: The DMA controller “steals” bus cycles from the CPU (cycle stealing) to perform the transfer.
- Efficiency: The processor is only interrupted once after the entire block of data has been transferred.
IO Channel
An IO channel (or IO processor) is an evolution of DMA that possesses its own instruction set.
- Mechanism: The processor places IO instructions in main memory and instructs the channel to execute them. The channel manages the entire transfer and interrupts the CPU only upon completion of the entire program.
- Types:
- Selector Channel: Manages multiple high-speed devices, but only one can be active at a time.
- Multiplexer Channel: Can handle multiple slow or medium-speed devices simultaneously by interleaving data transfers.