Revison Notes of Input Output
Revison Notes of Input Output
When a device interrupt occurs, how does the processor determine which device issued the
interrupt?
Four general categories of techniques are in common use: multiple interrupt lines; software
poll; daisy chain (hardware poll, vectored); bus arbitration (vectored).
When a DMA module takes control of a bus, and while it retains control of the bus, what
does the processor do?The processor pauses for each bus cycle stolen by the DMA module.
A particular system is controlled by an operator through commands entered from a keyboard.
The average number of commands entered in an 8-hour interval is 60.
a. Suppose the processor scans the keyboard every 100 ms. How many times will the
keyboard be checked in an 8-hour period?
The processor scans the keyboard 10 times per second. In 8 hours, the number of times
the keyboard is scanned is 10 × 60 × 60 × 8 = 288,000.
b. By what fraction would the number of processor visits to the keyboard be reduced if
interrupt-driven I/O were used?
Only 60 visits would be required. The reduction is 1 – (60/288000) = 0.999, or 99.9%
A 32-bit computer has two selector channels and one multiplexor channel. Each selector
channel supports two magnetic disk and two magnetic tape units. The multiplexor channel has
two line printers, two card readers, and 10 VDT terminals connected to it. Assume the
following transfer rates: Estimate the maximum aggregate I/O transfer rate in this system.
Only one device at a time can be serviced on a selector channel. Thus, Maximum rate = 800 +
800 + 2 × 6.6 + 2 × 1.2 + 10 × 1 = 1625.6 kB/sec
Two women are on either side of a high fence. One of the women, named Apple-server, has a
beautiful apple tree loaded with delicious apples growing on her side of the fence; she is happy
to supply apples to the other woman whenever needed. The other woman, named Apple-eater,
loves to eat apples but has none. In fact, she must eat her apples at a fixed rate (an apple a day
keeps the doctor away). If she eats them faster than that rate, she will get sick. If she eats them
slower, she will suffer malnutrition. Neither woman can talk, and so the problem is to get apples
from Apple-server to Apple-eater at the correct rate.
a. Assume that there is an alarm clock sitting on top of the fence and that the clock can have
multiple alarm settings. How can the clock be used to solve the problem? Draw a timing
diagram to illustrate the solution.
b. Now assume that there is no alarm clock. Instead Apple-eater has a flag that she can wave
whenever she needs an apple. Suggest a new solution. Would it be helpful for Apple-server
also to have a flag? If so, incorporate this into the solution. Discuss the drawbacks of this
approach.
c. Now take away the flag and assume the existence of a long piece of string. Suggest a solution
that is superior to that of (b) using the string.
Assume that the women are working, or sleeping, or otherwise engaged. The first time the
alarm goes off, it alerts both that it is time to work on apples. The next alarm signal causes
apple-server -61- to pick up an apple an throw it over the fence. The third alarm is a signal to
Apple-eater that he can pick up and eat the apple. The transfer of apples is in strict
synchronization with the alarm clock, which should be set to exactly match Apple-eater's needs.
This procedure is analogous to standard synchronous transfer of data between a device and a
computer. It can be compared to an I/O read operation on a typical bus-based system. The
timing diagram is as follows:
On the first clock signal, the port address is output to the address bus. On the second signal,
the I/O Read line is activated, causing the selected port to place its data on the data bus. On the
third clock signal, the CPU reads the data. A potential problem with synchronous I/O will occur
if Apple eater's needs change. If he must eat at a slower or faster rate than the clock rate, he
will either have too many apples or too few.
b. The women agree that Apple-server will pick and throw over an apple whenever he sees
Apple-eater's flag waving. One problem with this approach is that if Apple-eater leaves his flag
up, Apple server will see it all the time and will inundate her friend with apples. This problem
can be avoided by giving Apple-server a flag and providing for the following sequence:
1. Apple-eater raises her "hungry" flag when ready for an apple.
2. Apple-server sees the flag and tosses over an apple.
3. Apple-server briefly waves her "apple-sent" flag
4. Apple-eater sees the "apple-sent" flag, takes down her "hungry"
flag, and grabs the apple.
5. Apple-eater keeps her "hungry" flag stays down until she needs
another apple.
This procedure is analogous to asynchronous I/O. Unfortunately, Apple-server may be doing
something other than watching for her friend's flag (like sleeping!). In that case, she will not
see the flag, and Apple-eater will go hungry. One solution is to not permit apple
server to do anything but look for her friend's flag. This is a polling, or wait-loop, approach,
which is clearly inefficient.
c. Assume that the string that goes over the fence and is tied to Apple-server's wrist. Apple-
eater can pull the string when she needs an apple. When Apple-server feels a tug on the string,
she stops what she is doing and throws over an apple. The string corresponds to an interrupt
signal and allows Apple-server to use her time more efficiently. Moreover, if Apple-server is
doing something really important, she can temporarily untie the string, disabling the interrupt.