Table 2
| SCAN |
C-SCAN |
| Next track accessed |
Number of tracks traversed |
Next track accessed |
Number of tracks traversed |
| 110 |
10 |
110 |
10 |
| 120 |
10 |
120 |
10 |
| 129 |
9 |
129 |
9 |
| 147 |
18 |
147 |
18 |
| 186 |
39 |
186 |
39 |
| 64 |
122 |
10 |
176 |
| 41 |
23 |
27 |
17 |
| 27 |
14 |
41 |
14 |
| 10 |
17 |
64 |
23 |
| Average |
29.1 |
Average |
35.1 |
Consider the disk system described in Problem 11.9
and assume the disk rotates at 360 rpm. A processor reads one sector from the
disk using interrupt-driven I/O, with one interrupt per byte. If it takes 2.5 μs
to process each interrupt, what percentage of time will the processor spend
handling I/O (disregard seek time)? Repeat using DMA, and assume one interrupt
per sector.
Answer:
If you have the disk rotating at 360 rpm, then one
byte is read off the disk in:
T = b/rN = 1/(360 rpm*512 bytes/sector * 96
sectors/track)
T = 3.4 μs
If one interrupt occurs every byte, then the
operating system will process an interrupt (2.5 μs), then do some work, then
process another interrupt, etc. The time between interrupts is equal to the time
it takes to read one byte. In other words, the disk will read one byte, then
interrupt the operating system, then read another byte. The operating system
will only be able to get work done if it has enough time to finish processing an
interrupt before the next one occurs. In this case, the processor will spend 2.5
μs / 3.4 μs or 74% of its time handling I/O.
With DMA, there is only one interrupt for the entire
sector. It takes 3.4 μs/byte * 512 bytes/sector = 1,741 μs to read the sector.
Therefore the processor only spends 2.5 μs / 1741 μs = .14% of the time handling
I/O.
Note: The above answer does not take into account
rotational delay. If you include rotational delay, then the time to read a byte
becomes very large:
T = b/rN + 1/2r = 83 ms
This means the time the processor spends processing
interrupts is very small (approximately .003% in both cases).