0% found this document useful (0 votes)
4 views4 pages

progrm and interrupt dma

The document compares Programmed I/O and Interrupt Initiated I/O, highlighting their operational differences, advantages, and disadvantages. Programmed I/O requires the CPU to actively monitor devices, leading to inefficient CPU usage, while Interrupt Initiated I/O allows the CPU to perform other tasks until an interrupt signals that data is ready for transfer. Additionally, Direct Memory Access (DMA) is introduced as a technique that enables peripherals to communicate directly with memory, further improving system efficiency.

Uploaded by

wjjwjwsbjsjs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

progrm and interrupt dma

The document compares Programmed I/O and Interrupt Initiated I/O, highlighting their operational differences, advantages, and disadvantages. Programmed I/O requires the CPU to actively monitor devices, leading to inefficient CPU usage, while Interrupt Initiated I/O allows the CPU to perform other tasks until an interrupt signals that data is ready for transfer. Additionally, Direct Memory Access (DMA) is introduced as a technique that enables peripherals to communicate directly with memory, further improving system efficiency.

Uploaded by

wjjwjwsbjsjs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Difference between Programmed and Interrupt Initiated I/O

Between CPU and I/O devices can be processed by several modes in the computer
systems. There are two main ways that are used in I/O operations, and they
include programmed I/O and interrupt initiated I/O. The decision on these modes
has affected the performance of the system. The reader will find in this article a
comparison of the operation of these modes, their advantages and disadvantages,
as well as the impact they have on the efficiency of the overall system.
What is Programmed I/O?
In this mode the data transfer is initiated by the instructions written in a computer
program. An input instruction is required to store the data from the device to the
CPU and a store instruction is required to transfer the data from the CPU to the
device. Data transfer through this mode requires constant monitoring of the
peripheral device by the CPU and also monitor the possibility of new transfer once
the transfer has been initiated. Thus CPU stays in a loop until the I/O device
indicates that it is ready for data transfer. Thus programmed I/O is a time
consuming process that keeps the processor busy needlessly and leads to
wastage of the CPU cycles. This can be overcome by the use of an interrupt
facility. This forms the basis for the Interrupt Initiated I/O.
Advantages of Programmed I/O
 Provides simple and easy interfaces to programs.
 Direct access to interact with the CPU without involving any peripheral devices
in the process.
Disadvantages of Programmed I/O
 Synchronization is not efficient in terms of the CPU time as it will need to loop
waiting for the device to be ready.
 The CPU is idle and cannot handle any other task at the time it waits for the I/O
device to complete processing.
What is Interrupt Initiated I/O?
This mode uses an interrupt facility and special commands to inform the interface
to issue the interrupt command when data becomes available and interface is
ready for the data transfer. In the meantime CPU keeps on executing other tasks
and need not check for the flag. When the flag is set, the interface is informed and
an interrupt is initiated. This interrupt causes the CPU to deviate from what it is
doing to respond to the I/O transfer. The CPU responds to the signal by storing the
return address from the program counter (PC) into the memory stack and then
branches to service that processes the I/O request. After the transfer is complete,
CPU returns to the previous task it was executing. The branch address of the
service can be chosen in two ways known as vectored and non-vectored interrupt.
In vectored interrupt, the source that interrupts, supplies the branch information to
the CPU while in case of non-vectored interrupt the branch address is assigned to
a fixed location in memory.
Interrupt-initiated I/O, also referred to as hard-initiated I/O, is where input and
output operations are done when an interrupt signal is detected by the CPU.
Interrupt-initiated I/O is a more efficient one, as the I/O device sends a signal to the
CPU that it is ready for the data transfer. The CPU performs other tasks until it
receives an interrupt request.
Advantages of Interrupt-Initiated I/O
 Reduced overhead on the CPU as the same CPU waits for an interrupt while
doing other tasks at the same instance.
 There is also no need for monitoring the status of a specific device.
 Reduces CPU time wastage, hence enhancing the performance of the system.
Disadvantages of Interrupt-Initiated I/O
 Difficult to implement and program in contrast to sequential file processing or
compared to it when it is implemented in low-level languages.
 Needs interrupt handling routines, which can be time-consuming.
Difference Between Programmed and Interrupt Initiated
I/O
Programmed I/O Interrupt Initiated I/O

Data transfer is initiated by the means of


instructions stored in the computer The I/O transfer is initiated by the
program. Whenever there is a request for interrupt command issued to the
I/O transfer the instructions are executed CPU.
from the program.

There is no need for the CPU to


The CPU stays in the loop to know if the stay in the loop as the interrupt
device is ready for transfer and has to command interrupts the CPU when
continuously monitor the peripheral device. the device is ready for data
transfer.

The CPU cycles are not wasted as


This leads to the wastage of CPU cycles as
CPU continues with other work
CPU remains busy needlessly and thus the
during this time and hence this
efficiency of system gets reduced.
method is more efficient.

CPU can do any other work until it


CPU cannot do any work until the transfer
is interrupted by the command
is complete as it has to stay in the loop to
indicating the readiness of device
continuously monitor the peripheral device.
for data transfer

Its module is faster than


Its module is treated as a slow module.
programmed I/O module.

It can be tricky and complicated to


It is quite easy to program and understand. understand if one uses low level
language.

The performance of the system is severely The performance of the system is


degraded. enhanced to some extent.
Direct Memory Access (DMA)
Direct Memory Access (DMA) is a technique used in computers and other
electronic devices to allow peripherals (like hard drives, network cards, and sound
cards) to communicate directly with the main memory (RAM) without involving the
CPU. This process speeds up data transfer and frees up the CPU to perform other
tasks, improving overall system performance.
 The peripheral device sends a request to the DMA controller to initiate a data
transfer.
 The DMA controller takes control of the system’s memory bus and accesses
memory directly, either reading data from it or writing data to it.
 After the transfer is complete, the DMA controller signals the CPU that the task
is finished, and the CPU can continue with other tasks.
Working of DMA Transfer
Below diagram represents a Direct Memory Access (DMA) controller and its
components in a typical DMA system.

DMA Controller Components


1. Control Logic: The Control Logic is the central component that manages the
overall DMA operation. It processes control signals and directs data transfers
between the peripherals and memory. It receives commands from other
components and determines how and when data should be moved.
2. DMA Select and DMA Request: DMA Select is used by the DMA controller to
select the appropriate data transfer request. DMA Request is initiated by a
peripheral device when it needs to perform a data transfer. The request tells the
DMA controller that the device is ready to either read or write data.
3. DMA Acknowledge: The DMA Acknowledge signal is sent back from the control
logic to the peripheral device to confirm that the DMA operation has been
initiated and the device can proceed with the data transfer.
4. Bus Request and Bus Grant: Bus Request is generated by the DMA controller
when it needs access to the system's bus for data transfer. The Bus Grant
signal is sent from the CPU or the system’s bus controller to give the DMA
controller permission to use the bus for transferring data.
5. Address Bus and Data Bus: The Address Bus and Data Bus are used to transfer
data and memory addresses between the DMA controller, memory, and
peripherals. The Data Bus Buffer temporarily holds data being transferred, while
the Address Bus Buffer holds memory addresses.
6. Registers:
 Address Register: This stores the memory address where data will be written
or read from.
 Word Count Register: This keeps track of the number of words or units of
data that need to be transferred.
 Control Register: This contains control information, including the direction of
data transfer (read or write), and any other control signals necessary to
manage the DMA operation.
7. Internal Bus: The Internal Bus connects all the components inside the DMA
controller, allowing them to communicate and pass data efficiently.
8. Interrupt: The Interrupt signal is used to inform the CPU once the DMA
operation is completed. After the data has been transferred, the DMA controller
sends an interrupt to notify the CPU, so the CPU can resume processing or
handle other tasks.
Working:
 The DMA controller facilitates the transfer of data between memory and
peripherals without involving the CPU for each individual data operation, as
mentioned in the article.
 The DMA Select and DMA Request initiate the process when a peripheral wants
to transfer data, similar to how DMA allows peripherals to operate
independently of the CPU.
 Address Bus and Data Bus handle the flow of data and memory addresses
during the transfer, improving system efficiency by bypassing the CPU.
 The Registers (Address Register, Word Count Register, Control Register) store
the necessary information to control the transfer, as described in the article,
where DMA controls the movement of data between the device and memory.
 The Interrupt is triggered once the transfer is completed, similar to how the CPU
is notified in the article that DMA operations have been finished.
Types of DMA
There are several types of DMA, each with its own way of transferring data:
1. Burst Mode DMA:
 In this mode, the DMA controller takes control of the memory bus and
transfers a block of data in one go.
 The CPU is temporarily locked out of memory access while the DMA
controller completes the data transfer.
2. Cycle Stealing DMA:
 In this mode, the DMA controller transfers one data item at a time but allows
the CPU to access memory between each transfer.
 This allows the CPU and DMA controller to share the memory bus and work
more collaboratively.
3. Block Mode DMA:
 The DMA controller transfers a block of data without interruption, but it uses
a more organized approach than burst mode, allowing for more efficient
transfers.
 The CPU is locked out of memory access during the transfer.
4. Demand Mode DMA:
 In this mode, the DMA controller transfers data only when the CPU is not
using the memory bus, essentially waiting for an idle time to perform the
transfer.

You might also like