I/O & Disk Scheduling



Answer & solution
Answer: 14,003 ms = 14.003 s, under the stated ideal one-buffer read-ahead model. (no official key was published)
A record read takes 10 ms access plus 3200/(800×103) seconds transfer, or 14 ms total. The first read fills the buffer at t=14 ms. Copy record 1 into the program's local record variable at negligible cost, freeing the buffer immediately. The device can now read record 2 while the CPU processes record 1.
The timeline begins:
0–14 ms: read record 1; CPU has no record yet.
14–17 ms: process local record 1; read record 2 during 14–28 ms.
28–31 ms: process local record 2; read record 3 during 28–42 ms.
Because each read lasts 14 ms and each computation only 3 ms, the CPU finishes before the next record arrives. Record k is available at 14k ms. The final record, number 1000, arrives at 14,000 ms and must still be processed for 3 ms. Total elapsed time is 14,000+3=14,003 ms.
Equivalently, for N records, read time I and compute time C, this ideal single-record-buffer/local-variable pipeline takes I+(N−1)max(I,C)+C. Here it becomes 14+999×14+3. This formula includes the initial fill and final drain. The common shortcut N×max(I,C) would miss the last 3 ms.
One buffer is enough because the current record is moved out of that buffer before processing; CPU work uses the local copy while the device writes the next record to the buffer. This is not the same as processing in place in the sole buffer, which would prevent safe read-ahead. The source's negligible-copy assumption is what permits the overlap.