progrm and interrupt dma
progrm and interrupt dma
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