'Coding has over 700 languages', '67% of programming jobs aren’t in the technology industry', 'Coding is behind almost everything that is powered by electricity'
Last Updated: Feb 21, 2024
Medium

Modes of Transer - I/O interface (Programmed, interrupt, DMA)

Author Tanay Kumar
8 upvotes
gp-icon
Data structures & algorithms (Beginner to Intermediate)
Free guided path
13 chapters
99+ problems
gp-badge
Earn badges and level up

Introduction

The following blog discusses one of the important topics involved in Computer Organization and Architecture. 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.

modes of transfer

In this article, we will discuss different modes of transfer between the CPU to the I/O devices. 

Read more: Data Warehouse

Overview of Input Output Interface

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.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

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)


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.

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

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.

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.

Direct Memory Access

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.

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.
 

Conclusion

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.

Recommended Readings


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.

Previous article
Asynchronous Data Transfer
Next article
Priority Encoder
Guided path
Free
gridgp-icon
Data structures & algorithms (Beginner to Intermediate)
13 chapters
109+ Problems
gp-badge
Earn badges and level up
Live masterclass