There are four ways a computer system communicate with I/O devices.
- Direct control
- Programmed I/O
- Interrupt driven I/O
- Direct memory access
- Direct control :
- Old and obsolete technique.
- CPU interact directly with I/O devices with the help of dedicated program.
- Processing is extremely slow.
- Programmed I/O :
- CPU and I/O devices communicates through ‘Device Status Register’.
- Sets ‘ready’ status when device is ready to perform an operation and ‘busy’ while performing. So CPU is responsible to check the status of register.
- CPU is busy with device throughout the I/O operation. So this method wastes many precious CPU cycles.
- Interrupt Driven I/O :
- CPU hands over I/O command to special hardware called I/O handler which performs the I/O operations on I/O devices.
- When I/O handler completes the operation, the I/O handler informs the CPU by issuing an ‘interrupt’. Then the CPU stop the current executing instruction and save its and state and the control is passed to ISR( interrupt service routine), which completes the data transfer and the state of task whose I/O has been fulfilled is restored.
- The addresses of ISRs of the devices are kept in a list of addresses called the interrupt vector.
4. Direct Memory Access (DMA) :
- Transfer of data between memory and I/O devices is carried out without the involvement of CPU with the use DMA (a dedicated hardware to transfer the large amount of data).
- CPU provides following information to DMA :
- The address of the I/O device.
- The number of words to be transferred.
- The starting address in the main memory.
- The type of operation (read or write).
- DMA have the control of buses.
- DMA is useful only when a bulk of data needs to be transferred.