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.
- Programmed I/O
- Interrupt- initiated I/O
- Direct memory access( DMA)
We will see each of them in detail in the upcoming sections.
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.
- Programmed I/O is simple to implement.
- It requires very little hardware support.
- CPU checks status bits periodically.
- 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
In the above section, we saw that the CPU is kept busy unnecessarily. We can avoid this situation by using an interrupt-driven method for data transfer. 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.
- On interruptions:-
- Process interrupt by fetching data and storing it.
- See operation system notes.
- Starts working on the program it was executing.
- It is faster and more efficient than Programmed I/O.
- It requires very little hardware support.
- CPU does not check status bits periodically.
- 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.
- 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.
- It is costly and complex hardware.
- It has limited control over the data transfer process.
- Risk of data conflicts between CPU and DMA.
Frequently Asked Questions
What are the three types of DMA transfer techniques?
Direct Memory Access (DMA) transfer techniques include Burst Mode, transferring data blocks continuously; Cycle Stealing Mode, intermittently accessing the bus for single transfers; and Transparent Mode, utilizing CPU idle periods for transfers, minimizing impact on CPU performance.
What is interrupt initiated IO in computer architecture?
Interrupt-initiated I/O in computer architecture is a method where devices notify the CPU of their need for attention through interrupts, allowing the CPU to manage I/O operations efficiently without continuously polling the devices.
Who initiates a DMA transfer?
Direct Memory Access (DMA) is the fastest way to transfer data. It allows peripherals to access memory directly. This makes data transfer quicker and reduces the workload on the central processor, making the system perform better.
What is the fastest mode of data transfer?
To increase data transfer speeds, you can employ high-speed hardware like SSDs instead of HDDs; it upgrades faster internet connections with higher bandwidth, optimized network settings, and ensures no bandwidth-consuming applications run in the background.
Which transfer mode doesn't use interrupt?
The Direct Memory Access (DMA) transfer mode doesn't use interrupt. It allows specific devices to access the memory of the system directly and it reduces CPU involvement and increases data transfer efficiency.
In this article, we learned about different modes of transfer, Programmed i/O, Interrupt-initiated I/O, and Direct Memory Access (DMA), and their advantages and disadvantages. We hope this article was helpful.
Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, etc. as well as some Contests, Test Series, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.
We hope you found this blog helpful. Liked the blog? Then feel free to upvote and share it.