GATE / CS ARCHIVE

SIMILAR QUESTIONS / COMPUTER ORGANIZATION & ARCHITECTURE

Account for CPU time consumed by I/O events

6 questions solved the same way, newest first. Back to Computer Organization & Architecture

How these are solved

Find event frequency and multiply by CPU-occupied time per event, then express utilization or its complement. The 1993 response delay still executes main code and must not count as service; save/service/restore do count.

2 marks · MCQ
Report issue

Cycle-stealing DMA blocking fraction

Input/Output, DMA & Interrupts

Question 70, GATE 2005: Disk:16 surfaces, 512 tracks/surface, 512 sectors/track, 1 KB/sector, 3000 rpm. DMA steals a 40 ns memory cycle for each four-byte word. Maximum CPU-blocked percentage: A10; B25; C40; D50. Check exact units rather than assuming one option is exact.
Tap to enlarge
Your answer
Answer & solution

Answer: B, approximate only (no official key was published)

One track passes the head per revolution; surfaces and tracks determine capacity, not a multiplier of simultaneous transfer rate. Rotation rate is 3000/60=50 revolutions/s. With binary KiB, the transfer rate is 512×1024×50 bytes/s. At four bytes per stolen cycle, memory is occupied for (512×1024×50/4)×40×10−9=0.262144 of the time, or 26.2144%. The nearest option is B (25%), but no option equals the exact result. Decimal KB gives 25.6%, still not exactly 25%; B requires approximate arithmetic.

Compute the streaming rate for the track under one active head:50 revolutions/s times 512 sectors/revolution times 1024 bytes/sector. Divide by 4 to obtain stolen cycles/s, then multiply by 40 ns/cycle. This dimensional chain yields 0.262144 seconds blocked per second. Multiplying by surfaces or total tracks would incorrectly assume simultaneous transfer from all disk positions. B is nearest, but 26.2144% is not exactly 25%.

Original paper, page 9

2 marks · MCQ
Report issue

Processor overhead for DMA blocks

Input/Output, DMA & Interrupts

Question 68, GATE 2004: A disk continuously transfers at 10 Mbytes/s using DMA. A 600-MHz CPU uses 300 cycles to initiate and 900 cycles to complete each 20-Kbyte DMA block transfer. What percentage of CPU time is consumed by transfer overhead?
Options:
(A) 5.0%
(B) 1.0%
(C) 0.5%
(D) 0.1%
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. The CPU spends 300+900=1200 cycles per block, or 1200/(600×106)=2 microseconds. At 10 MB/s a 20 KB block takes approximately 2 milliseconds, so CPU overhead is 2 microseconds / 2 milliseconds ×100%=0.1%, D.

2. Consistent binary KB/MB units give about 0.1024%, still the stated approximation. This counts setup/completion CPU time, not the disk-transfer duration as busy CPU time.

3. Teaching check: DMA frees the CPU during the bulk data movement. Charge only 1200 CPU cycles per transfer, not the full disk-transfer interval. Using consistent seconds and clock cycles gives a dimensionless ratio before multiplying by 100 to express a percentage.

Original paper, page 10

Descriptive
Report issue

CPU occupation for byte interrupts

Input/Output, DMA & Interrupts

Question 8(c), GATE 2001: Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.

Task: Find the percentage of CPU time required for byte-wise interrupt-driven transfer.
Question 8(c), GATE 2001: Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.

Task: Find the percentage of CPU time required for byte-wise interrupt-driven transfer.
Tap to enlarge
Shared context

Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.

Answer & solution

Answer: 40.96% of CPU time during sustained disk transfer. (no official key was published)

1. The sustained disk rate is 50×16×1024=819,200 bytes/s. Each byte causes its own interrupt, so there are 819,200 interrupts per second of streaming transfer.

2. For each byte the CPU pays both 0.4 μs interrupt overhead and 0.1 μs memory read/write time. Total CPU service is 0.5 μs/byte.

3. CPU busy time per elapsed second is 819,200×0.5 μs=409,600 μs=0.4096 seconds. Therefore utilization is 0.4096×100=40.96%.

4. Counting only the interrupt overhead would give 32.768% and omit the specified data transfer cost. The remaining time can be used for unrelated computation under the stated model.

Original paper, page 8

Descriptive
Report issue

Cycle-stealing DMA occupation

Input/Output, DMA & Interrupts

Question 8(d), GATE 2001: Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.

Task: Find the maximum percentage of CPU time held up by cycle-stealing DMA.
Question 8(d), GATE 2001: Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.

Task: Find the maximum percentage of CPU time held up by cycle-stealing DMA.
Tap to enlarge
Shared context

Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.

Answer & solution

Answer: Maximum CPU hold-up is 8.192% during sustained transfer. (no official key was published)

1. Cycle-stealing DMA transfers each byte directly between the device and memory. It does not invoke the CPU once per byte, so the 0.4 μs interrupt overhead does not apply.

2. The memory bus is taken for the specified 0.1 μs per byte. At 819,200 bytes/s, DMA occupies memory for 819,200×0.1 μs=81,920 μs per second.

3. If every stolen cycle would otherwise have been useful to the CPU, the CPU is held up for the full 0.08192 seconds per second: 8.192%. This is the requested maximum.

4. Actual processor slowdown can be lower if some stolen bus cycles overlap times when the CPU needs no memory service. Initialization and termination costs are excluded because the question explicitly makes them negligible.

Original paper, page 8

5 marks · Descriptive
Report issue

CPU overhead of continuous DMA transfers

Input/Output, DMA & Interrupts

Question 25, GATE 1996: A 50 MHz processor uses DMA for a disk transferring 2000 Kbytes/s continuously. The average DMA block is 4 Kbytes. Each transfer needs 1000 processor cycles for setup and 500 processor cycles for its completion interrupt. What fraction of CPU time is consumed by disk handling?
Tap to enlarge
Answer & solution

Answer: 0.015 of processor time, i.e. 1.5%. (no official key was published)

First count transfers rather than bytes: 2000 Kbytes/s divided by 4 Kbytes/transfer is 500 transfers/s. The same meaning of K occurs in both quantities and cancels, so decimal versus binary K does not change this rate.

The processor performs 1000+500=1500 cycles of administrative work for every transfer. At 500 transfers/s this costs 750,000 CPU cycles/s. A 50 MHz processor supplies 50,000,000 cycles/s, so the fraction used is 750,000/50,000,000=0.015, or 1.5 percent.

An equivalent time calculation checks the units. Each processor cycle lasts 1/(50×106) s=20 ns. Setup takes 20 microseconds and the completion handler takes 10 microseconds, totaling 30 microseconds per transfer. Transferring 4K bytes at 2000K bytes/s takes 0.002 s=2 milliseconds; 30 microseconds/2 milliseconds again equals 0.015. The transfer uses DMA, so the CPU is not charged for executing an instruction per byte. The calculation counts only the specified setup and completion overhead; additional bus-contention stalls, queuing effects, or other driver costs are not given and should not be invented. The statement that the disk transfers continuously fixes the block rate at its full throughput.

Original paper, page 10

2 marks · Other
Report issue

CPU time retained by the main program

Input/Output, DMA & Interrupts

Question 6.8, GATE 1993: Interrupts arrive every 1 ms. The diagram shows 10 μs response delay while main code still runs, then 10 μs save,80 μs service,10 μs restore. What fraction remains for main execution?
Tap to enlarge
Answer & solution

Answer: 90% (no official key was published)

Only saving, servicing and restoring displace main-program execution: 10+80+10=100 μs per interrupt. Each arrival period is 1000 μs, leaving 900 μs for the main program, or 90%. The initial 10 μs response delay is drawn while main execution continues, so it must not be subtracted again. Doing so would give 89% and double-count time not actually lost. This assumes the depicted nonoverlapping periodic service and no extra overhead beyond the labeled intervals.

Original paper, page 5