COA 5 Part 1
COA 5 Part 1
ARCHITECTURE
Control lines
Input device
• Consider a task that reads characters typed on a keyboard, stores these data in the
memory, and displays the same characters on a display screen.
• In addition to transferring each character from the keyboard into the memory,
and then to the display, it is necessary to ensure that this happens at the right
time.
• An input character must be read in response to a key being pressed.
• For output, a character must be sent to the display only when the display
device is able to accept it.
• It also provide faster response times for I/O operations as they are treated the same
as memory access, reducing overhead in communication.
• It can lead to potential conflicts between memory and I/O devices if not properly
managed, as both share the same address space.
• Program-controlled I/O:
• Processor repeatedly monitors a status flag to achieve the necessary
synchronization.
• Processor polls the I/O device.
Interrupt-service routine may not have anything in common with the program
it interrupts.
As a result, before branching to the interrupt-service routine, not only the PC,
but other information such as condition code flags, and processor registers
used by both the interrupted program and the interrupt service routine must be
stored.
This will enable the interrupted program to resume execution upon return from
interrupt service routine.
Any additional information that must be saved, must be saved explicitly by the
program instructions at the beginning of the interrupt service routine.
INTR is an
active low
signal.
Interrupt-requests interrupt the execution of a program, and may alter the intended
sequence of events:
Processors generally provide the ability to enable and disable such interruptions as
desired.
Multiple I/O devices may be connected to the processor and the memory via a
bus. Some or all of these devices may be capable of generating interrupt requests.
• How does the processor know which interrupt service routine needs to be
executed?
• When the processor is executing an interrupt service routine for one device, can
other device interrupt the processor?
• If two interrupt-requests are received simultaneously, then how to break the tie?
When the processor receives an interrupt request over this control line, how does
it know which device is requesting an interrupt?
• Polling
• Vectored Interrupts
• Interrupt Nesting
Interrupt service routine can poll the I/O devices connected to the bus. The first
device with IRQ equal to 1 is the one that is serviced.
Polling mechanism is easy, but time consuming to query the status bits of all the
I/O devices connected to the bus.
• Device can do so by sending a special code (4 to 8 bits) the processor over the
bus
• Code supplied by the device may represent a part of the starting address of the
interrupt-service routine.
• The Interrupt Service Routine for a device must always starts at the same location.
• Usually, the location pointed to by the interrupting device is used to store the
starting address of the interrupt-service routine.
• The processor reads this address, called the interrupt vector and loads it into the
PC
Reshma M R, Dept of CSE, RSET
Handling Multiple Devices: Interrupt Nesting
• Previously, before the processor started executing the interrupt service routine for
a device, it disabled the interrupts from the device.
In general, same arrangement is used when multiple devices can send interrupt
requests to the processor.
During the execution of an interrupt service routine of device, the processor
does not accept interrupt requests from any other device.
Since the interrupt service routines are usually short, the delay that this causes
is generally acceptable.
• Priority can be changed by instructions that write into the processor status
register.
• Usually, these are privileged instructions, or instructions that can be executed
only in the supervisor mode.
• Privileged instructions cannot be executed in the user mode.
• Prevents a user program from accidentally or intentionally changing the
priority of the processor.
IN T R 1 INTR p
Processor
INTA1 INTA p
Priority arbitration
• Interrupt requests received over these lines are sent to a priority arbitration circuit
in the processor.
• If the interrupt request has a higher priority level than the priority of the processor,
then the request is accepted.
• If the I/O devices are organized in a priority structure, the processor accepts the
interrupt request from a device with higher priority.
• However, if the devices share an interrupt request line, then how does the
processor decide which interrupt request to accept?
• If the processor uses a polling mechanism to poll the status registers of I/O devices
to determine which device is requesting an interrupt.
• In this case the priority is determined by the order in which the devices are polled.
• The first device with status bit set to 1 is the device whose interrupt request is
accepted.
Processor
• When I/O devices were organized in a daisy chain fashion, the devices shared an
interrupt-request line, and the interrupt-acknowledge propagated through the
devices.
• A combination of priority structure and daisy chain scheme can also used.(general
structure)
• Control unit which performs these transfers is a part of the I/O device’s interface
circuit. This control unit is called as a DMA controller.
• For each word transferred, it provides the memory address and all the control
signals.
DMA controller can transfer a block of data from an external device to the
processor, without any intervention from the processor.
However, the operation of the DMA controller must be under the control of a
program executed by the processor. That is, the processor must initiate the
DMA transfer.
• To initiate the DMA transfer, the processor informs the DMA controller of:
• Starting address,
• Number of words in the block.
• Direction of transfer (I/O device to the memory, or memory to the I/O device).
• On receiving this the DMA controller proceeds to perform the requested operation.
• Once the DMA controller completes the transfer of entire block (DMA transfer), it
informs the processor by raising an interrupt signal.
• When a DMA transfer is taking place the program that request the transfer cannot
continue and the processor can be used to execute another program.
• After the DMA transfer is completed, the processor can return to the program that
requested the transfer
• When the controller has completed transferring a block of data and is ready to
receive another command, it sets the Done flag to 1.
• Finally, the controller sets the Bit 31 (IRQ bit) to 1 when it has requested an
interrupt.
Disk Disk Network • The registers to store the memory address, word
Interface
count and status and control information are
duplicated.
Processor and DMA controllers have to use the bus in an interwoven fashion to
access the memory.
DMA devices are given higher priority than the processor to access the bus.
DMA controller can be said to “steal” memory access cycles from the bus. This
interweaving technique is called as “cycle stealing”.