Typically, an Interrupt Driven I/O mode is used simply to overcome the limitations and downsides of the Programmed I/O mode wherein the CPU is kept busy unnecessarily.
On the other hand, in Direct Memory Access mode of data transfer, the process is quite similar but it is the DMA controller that does the needful.
If you are unaware of the differences between these particular modes of data transfer, this article will provide a part of the knowledge stating the differences between Direct Memory Access and Interrupt mode.
In This Article
- The data transfer process in DMA is fast and is controlled by hardware but the same in the Interrupt Driven I/O mode is controlled by software and is quite slow.
- There is no involvement of the CPU in the actual DMA mode of data transfer but it is fully under control of the CPU in the other.
- The DMA mode of data transfer is suitable to transfer large amounts of data which is not the case with Interrupt Driven I/O mode.
- There is no drop in the performance level in DMA mode since it is controlled fully by an external controller but in Interrupt Drive mode the process has to wait until the current instruction is executed by the CPU.
The 10 Differences Between Direct Memory Access (DMA) and Interrupts
1. Data Transfer Process Control
The Direct Access Memory data transfer process is hardware controlled.
On the other hand, the Interrupt Driven I/O mode is typically a software controlled data transfer process.
2. Data Transfer Speed
In Direct Memory Access mode, the data transfer process is pretty fast.
On the other hand, the data transfer speed in Interrupt Driven I/O mode is quite slow.
3. Involvement of the CPU
In the actual Direct Memory Access mode of data transfer, the Central Processing Unit is not involved.
On the other hand, in the Interrupt Driven I/O mode of data transfer there is full control of the CPU in the complete transfer process.
4. Hardware Requirement
In Direct Memory Access mode of data transfer, it is the DMA controller that takes all the responsibility of the job and therefore there is the need for this particular hardware in this process.
On the other hand, in the Interrupt Driven I/O mode of data transfer there is no need for any hardware at all because it is the CPU that handles everything.
5. Routing Channel
In Direct Memory Access mode of data transfer, the data is not routed through the CPU.
On the other hand, in the Interrupt Driven I/O mode the processor is used as the routing channel for the data transfer.
6. Data Size
The Direct Memory Access mode of data transfer is best suited when there is a need to transfer a huge amount of data.
On the other hand, the Interrupt Driven I/O mode is not that efficient and therefore is best suited for transferring data in small amounts.
7. Performance Effects
In the Direct memory Access mode of data transfer, the overall performance of the system does not drop because the entire process is handled by the external controller.
Therefore, the processor does not need to sit idle while the data transfer is in progress. It can continue doing other tasks that do not need the system bus.
On the other hand, in the Interrupt Driven I/O mode of data transfer, since transferring of data by reading from or writing to the memory location directly is done by the CPU, the performance level drops a bit because the processor needs to cease its current execution of a program or an instruction.
Direct Memory Access is a process wherein the devices access the main memory of the system or the Random Access Memory circumventing the processor of the computer.
On the other hand, Interrupt Driven I/O mode of data transfer is a process that involves interrupt signals that are sent by a device to the processor to indicate that some event has occurred.
9. Working Process
In Direct Memory Access bus request signal is sent to the CPU which completes the current bus cycle and grants the control to the device.
The device henceforth asserts the bus grant acknowledgement signal and this change of state is sensed by the CPU and it listens to the address and data bus for DMA activity.
The DMA controller then performs the actual data transfer from the source to the destination.
On the other hand, in Interrupt Driven I/O mode of data transfer, an ISR is sent to the CPU which then takes it from there and gets involved with the data transferring process itself after registering the interrupt.
It waits to finish executing the current instruction and initiates interrupt handling by switching over to supervisor mode and initiating the interrupt acknowledge cycle and fetches the vector matching with the interrupt level.
10. Synchronization Requirements
The synchronization requirements with Direct Memory Access include using the read-modify-write bus cycle, or disabling DMA operation, or disable the device temporarily from performing DMA.
However, all of these should be done with care so that the performance is not affected.
On the other hand, the synchronization requirements with Interrupt Driven I/O mode of data transfer include disabling the interrupt from executing critical region updates, or ensuring that interrupts are routed at instruction boundaries.
Which One More Required – DMA or Interrupts?
Both Direct Memory Access and Interrupt Driven I/O mode of data transfer originate from a device but that is where the similarities in them end.
There are quite a few differences between them as you can see from the section above, and that is good enough to make things a bit clearer to you.
However, if you want to know about which is more required in modern computing then the balance will slightly tend towards Direct Memory Access rather than Interrupt Driven I/O mode of data transfer.
And, there are several reasons for it.
In order to understand things in depth, you will also need to know all these following facts and information about both Direct Memory Access and Interrupt Driven I/O mode of data transfer.
In the Interrupt Driven I/O approach the peripherals send an interrupt signal to the processor only when it is ready to make a data transfer, which means that the I/O data transfer is set off by the external I/O device.
When such a signal is made the processor ceases the execution of the current instructions and gives up the control.
This means that the CPU interrupts its operation only when it is interrupted.
The data transfer process is then performed by the interrupt service routine.
And, after the data transfer process is completed, the control is given back to the main program and to the point it was interrupted.
In DMA, however, in order to transfer data to and from the memory unit the interface uses the memory bus.
The CPU here provides the necessary information for the data transfer such as:
- The starting address and
- The number of bytes of data to be transferred to the interface.
The data transfer is initiated only after that and the CPU carries on with its other operations.
When the data transfer is to be made, a memory cycle is requested by the DMA controller through the memory bus.
It is only when the memory controller grants the request, the data is transferred directly to the memory.
During this process, in order to facilitate direct memory transfer, the processor remains idle and delays its operation of accessing the memory.
Therefore, in Direct Memory Access, it is the DMA controller that actually plays the significant role in allowing the I/O devices to access the memory directly with less or no intervention from the processor.
In the Interrupt Driven I/O mode of data transfer any occasion can interrupt the CPU at any time but the latency depends on the time the processor itself takes to acknowledge receiving the notification.
Also, the CPU is at the discretion to choose the priority of events and postpone services till the right moment.
However, in Direct Memory Access, all events, especially data transfer, can happen behind the scene with no CPU involvement.
Therefore, it is most suited for, but is not restricted to large data transfers, as said earlier.
DMA data transfer can happen between different sources and destinations such as:
- From a peripheral device to the memory
- From the memory to a peripheral device and
- Even from memory to memory.
If you want to know some examples where a DMA data transfer happens, there can be many of them such as:
- Audio recording and playback
- Video recording and playback and
- High speed ADC sampling.
Therefore, it can be said that in the computer world there is no single mechanism that is best for the overall performance of the system.
It all depends on several important parameters as to which way you will view the importance of one mechanism over the other.
These parameters include:
- The whole functionality of the computer system
- All the subsystem related to the main system
- The given conditions and computing needs and, of course,
- Your personal preference.
You can even have both the data transfer modes used in different parts of the system as well as for different processes, especially when your system is equipped with low level drivers.
Ideally, both these processes are related in terms of moving data from point A to a predetermined point B when you consider their functions and performance.
Typically, Direct Memory Access uses interrupts when it comes to notifying the processor when the block transfer of data is required to be done or when it needs additional data.
Interrupt Driven I/O mode of data transfer can be almost deterministic but Direct Memory Access can be quite deterministic especially in the isolated and low end bus architectures.
On the other hand, in the case of the high end parts, it is the bus arbitration that adds uncertainty to it.
And, as said earlier, the Interrupts are pure signals and do not perform actual I/O operation but ask the CPU to perform such operations.
In comparison, DMA reads data from the input port and copies the same to the main memory or RAM of the system.
However, in DMA it is not always required to perform I/O. It can even copy the data simply inside the RAM just like in a regular memory function.
But, no matter whatever is the action performed, DMA is certainly not as fast as the CPU of the computer when it comes to reading and writing data from and to the memory.
It simply works in the background, but slowly.
As a matter of fact, the beginners typically do not want to use DMA because they do not want to add an additional level of complexity in the system, and DMA can be really complex.
Add to that, there are quite a few DMA limitations and its performance level depends on the CPU, believe it or not.
Interrupts, just as the name implies, disrupts the present program with an ISR or Interrupt Service Routine.
These routines are produced at a time when some crucial event needs immediate attention by the hardware.
However, at times, an ISR can also be produced by software to enforce the initial ISR to commence.
When it is finished, the program that is interrupted continues from the point of interruption as if nothing had happened.
However, in some cases the ISR itself can be disrupted by another interrupt but that should have a higher priority.
These particular secondary interrupts are referred to as nested interrupts.
These numbers of interrupts can be significantly reduced with the use of DMA which will increase the performance of the overall system in comparison to the Interrupt Driven I/O.
That is why Direct Memory Access is more important and is used mostly when there is a need to transfer big chunks of data on a regular basis.
After reading this article, now you surely are more knowledgeable than you were before regarding the Direct Memory Access and Interrupt Driven I/O mode of data transfer.
Following the differences between the two as well as the facts mentioned above, you also know now which is more important.