Modes of Transfer - I/O interface
The method used for transferring information between external I/O devices and internal storage is known as
the I/O interface. We use special communication links to interface the CPU with the peripherals connected to
any computer system. We use these communication links to resolve the differences between the CPU and
peripheral.
The Input-Output Interface is an essential component in computer systems. It enables communication between
the CPU and various external devices. These external devices are peripherals like keyboards, monitors,
printers, and storage devices such as hard drives, network interfaces, etc.
Modes of Transfer
We store the binary information received through an external device in the memory unit. The information
transferred from the CPU to external devices originates from the memory unit. Although the CPU processes
the data, the target and source are always the memory unit. We can transfer this information using three
different modes of transfer.
1. Programmed I/O
2. Interrupt- initiated I/O
3. Direct memory access( DMA)
1. Programmed I/O
Programmed I/O uses the I/O instructions written in the computer program. The instructions in the program
initiate every data item transfer. Usually, the data transfer is from a memory and CPU register. This case
requires constant monitoring by the peripheral device's CPU.
Advantages:
• Programmed I/O is simple to implement.
• It requires very little hardware support.
• CPU checks status bits periodically.
Disadvantages:
• The processor has to wait for a long time for the I/O module to be ready for either transmission or
reception of data.
• The performance of the entire system is severely degraded.
2. Interrupt-initiated I/O
The interrupt facilities and special commands inform the interface for issuing an interrupt request signal as
soon as the data is available from any device. In the meantime, the CPU can execute other programs, and the
interface will keep monitoring the i/O device. Whenever it determines that the device is ready for transferring
data interface initiates an interrupt request signal to the CPU. As soon as the CPU detects an external interrupt
signal, it stops the program it was already executing, branches to the service program to process the I/O transfer,
and returns to the program it was initially running.
Working of CPU in terms of interrupts:
• CPU issues read command.
• It starts executing other programs.
• Check for interruptions at the end of each instruction cycle.
• Process interrupt by fetching data and storing it.
• See operation system notes.
Starts working on the program it was executing.
Advantages:
• It is faster and more efficient than Programmed I/O.
• It requires very little hardware support.
• CPU does not check status bits periodically.
Disadvantages:
• It can be tricky to implement if using a low-level language.
• It can be tough to get various pieces of work well together.
• The hardware manufacturer / OS maker usually implements it, e.g., Microsoft.
3. Direct Memory Access (DMA)
The data transfer between any fast storage media like a memory unit and a magnetic disk gets limited with the
speed of the CPU. Thus it will be best to allow the peripherals to directly communicate with the storage using
the memory buses by removing the intervention of the CPU. This mode of transfer of data technique is known
as Direct Memory Access (DMA). During Direct Memory Access, the CPU is idle and has no control over the
memory buses. The DMA controller takes over the buses and directly manages data transfer between the
memory unit and I/O devices.
CPU Bus Signal for DMA transfer
Bus Request - We use bus requests in the DMA controller to ask the CPU to relinquish the control buses.
Bus Grant - CPU activates bus grant to inform the DMA controller that DMA can take control of the control
buses. Once the control is taken, it can transfer data in many ways.
Types of DMA transfer using DMA controller:
Burst Transfer: In this transfer, DMA will return the bus control after the complete data transfer. A register is
used as a byte count, which decrements for every byte transfer, and once it becomes zero, the DMA Controller
will release the control bus. When the DMA Controller operates in burst mode, the CPU is halted for the
duration of the data transfer.
Cyclic Stealing: It is an alternative method for data transfer in which the DMA controller will transfer one
word at a time. After that, it will return the control of the buses to the CPU. The CPU operation is only delayed
for one memory cycle to allow the data transfer to “steal” one memory cycle.
Advantages
• It is faster in data transfer without the involvement of the CPU.
• It improves overall system performance and reduces CPU workload.
• It deals with large data transfers, such as multimedia and files.
Disadvantages
• It is costly and complex hardware.
• It has limited control over the data transfer process.
• Risk of data conflicts between CPU and DMA.