Interrupt-Driven
I/O
With
programmed I/O, the processor has to wait a long time for the I/O module of concern
to be ready for either reception or transmission of more data. The processor,while
waiting,must repeatedly interrogate the status of the I/O module.As a result,
the performance level of the entire system is severely degraded.
An
alternative is for the processor to issue an I/O command to a module and then go
on to do some other useful work.The I/O module will then interrupt the
processor to request service when it is ready to exchange data with the
processor.The processor then executes the data transfer, as before, and then
resumes its former processing.
Let
us consider how this works, first from the point of view of the I/O module. For
input, the I/O module receives a READ command from the processor. The I/O module
then proceeds to read data in from an associated peripheral. Once the data are
in the module’s data register, the module signals an interrupt to the processor
over a control line. The module then waits until its data are requested by the
processor. When the request is made, the module places its data on the data bus
and is then ready for another I/O operation.
From
the processor’s point of view, the action for input is as follows. The processor
issues a READ command. It then saves the context (e. g., program counter and
processor registers) of the current program and goes off and does something
else (e. g., the processor may be working on several different programs at the
same time).At the end of each instruction cycle, the processor checks for interrupts.
When the interrupt from the I/O module occurs, the processor saves the context
of the program it is currently executing and begins to execute an interrupt-handling
program that processes the interrupt. In this case, the processor reads the
word of data from the I/O module and stores it in memory. It then restores the
context of the program that had issued the I/O command (or some other program) and
resumes execution.
shows
the use of interrupt-driven I/O for reading in a block of data.
Interrupt-driven I/O is more efficient than programmed I/O because it eliminates
needless waiting.However, interrupt-driven I/O still consumes a lot of processor
time, because every word of data that goes from memory to I/O module or from I/O
module to memory must pass through the processor.
Almost
invariably, there will be multiple I/O modules in a computer system, so mechanisms
are needed to enable the processor to determine which device caused the
interrupt and to decide, in the case of multiple interrupts, which one to
handle first. In some systems, there are multiple interrupt lines, so that each
I/O module signals on a different line. Each line will have a different
priority.Alternatively, there can be a single interrupt line, but additional
lines are used to hold a device address. Again, different devices are assigned
different priorities.
No comments:
Post a Comment