🎓 BookMCQ
← Back to 20. Influential Operating Systems

📝 Overlapped I/O operating system (18 MCQs)

Allowing Input and Output to Proceed Alongside Computation

Overlapped I/O refers to operating-system techniques that let input or output activity proceed while the processor performs other work. Early systems used separate peripheral operations and magnetic-tape staging to reduce dependence on slow card readers and printers. Later implementations used buffering, interrupts, and direct memory access so that device transfers and CPU execution could progress concurrently.

Solving the Speed Difference Between Processors and Peripherals

Mechanical input and output devices were much slower than electronic processors. A CPU could execute thousands of instructions while a card reader or printer completed a small part of its operation. Keeping the processor directly involved in every device transfer wasted valuable cycles. Overlap reduces this mismatch by allowing independent device activity to continue without continuous CPU intervention.

Off-Line Preparation, Buffers and Asynchronous Transfers

In early batch environments, card input could be copied to magnetic tape by a separate device, and program output could be written to tape for later printing. With asynchronous I/O, the operating system starts a transfer and continues other work. A device controller or DMA engine handles data movement, then an interrupt can report completion.

Reading a Tape While the Processor Executes a Job

Imagine a batch computer processing records already stored on magnetic tape while another tape unit prepares the next input set. The CPU continues calculations instead of waiting for a card reader to deliver every record. In a buffered design, a completed input block becomes available to the program while a device fills another buffer.

Improved Throughput and Remaining I/O Bottlenecks

Overlapped activity reduces processor idle time and increases job throughput, particularly in data-intensive batch workloads. Its effectiveness depends on buffering capacity, transfer rates, device independence, and whether useful CPU work is available. Buffer exhaustion, slow storage, or heavy device contention can still delay programs. Overlap also requires coordination to prevent data corruption and incorrect completion handling.

Three Misconceptions About Overlapped I/O

'The CPU must copy every byte itself' is incorrect when DMA performs transfers. 'Overlapping I/O makes the device faster' is false; it hides some waiting time rather than increasing the device's physical speed. 'An I/O request always blocks the process until completion' is misleading; asynchronous operations can let execution continue.

Exam Focus: Distinguish Off-Line I/O, Buffering and DMA

Students should explain how tape staging separated card readers and printers from the main computer, and how asynchronous transfers overlap device work with computation. Distinguish buffering from DMA and interrupts. Given an I/O sequence, identify when the CPU can execute another task, when a completion event occurs, and why overlap improves utilisation rather than raw device speed.

Key Terms of Overlapped I/O

  • Asynchronous I/O - Transfer proceeds without waiting.
  • Buffer - Temporary storage for transferred data.
  • DMA - Device-assisted direct memory transfer.
  • Interrupt - Signal reporting an event.
  • Off-line I/O - Peripheral work separated from CPU processing.
3
Easy
8
Medium
7
Hard

📝 All Overlapped I/O operating system MCQs

Q1. What primary capability does overlapped I/O provide to a program?

A.It allows I/O and computation to proceed simultaneously
B.It guarantees faster network latency ✅
C.It eliminates the need for buffers
D.It converts asynchronous operations to synchronous ones
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Overlapped I/O lets a program start an I/O request and then continue executing other code while the hardware works. This overlap of computation and I/O is the core benefit. Option B is wrong because latency depends on many factors, not just overlapped I/O. Option C is incorrect because buffers are still needed to hold data. Option D misstates the nature: overlapped I/O is already asynchronous, not a conversion to synchronous behavior.

Q2. Which Windows API function can be used to initiate an overlapped read operation?

A.ReadFile ✅
B.CreateFile
C.OpenProcess
D.CloseHandle
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: ReadFile is the function that, when supplied with an OVERLAPPED structure, starts an asynchronous read request. The other functions manage file handles or processes but do not directly issue overlapped I/O. CreateFile only opens a handle, OpenProcess works with processes, and CloseHandle releases resources. Therefore, only ReadFile correctly initiates the overlapped operation, allowing the program to continue while data is being transferred.

Q3. How does overlapping I/O with computation affect CPU utilization in a typical desktop environment?

A.It reduces CPU idle time by keeping the processor busy with useful work ✅
B.It causes the CPU to wait longer for I/O completion
C.It forces the CPU to switch to a low‑power state during I/O
D.It eliminates the need for any CPU scheduling
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: When I/O is overlapped, the CPU can perform other tasks while the I/O device works, which generally reduces idle periods. However, the CPU may still enter low‑power states if there are no ready tasks, but it does not wait for I/O like in blocking calls. The statement that it forces low‑power mode is inaccurate; the CPU’s power state depends on the scheduler. Thus, the best description is that CPU idle time is reduced, making option A the correct choice.

Q4. Why is a completion routine often used with overlapped I/O in event‑driven programs?

A.To block the thread until the I/O finishes ✅
B.To periodically poll the device status
C.To notify the program immediately when the operation completes
D.To increase the size of the I/O buffer automatically
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A completion routine is a callback that the system invokes as soon as an overlapped operation ends, allowing the program to react without polling or blocking. Option A describes blocking I/O, which defeats the purpose of overlap. Option B suggests active polling, which is less efficient than callbacks. Option C is close but phrased as “notify immediately,” which is essentially what a completion routine does, making it the correct answer. Option D is unrelated to notification mechanisms.

Q5. How does the use of multiple overlapped I/O requests improve data throughput on a high‑latency storage device?

A.It forces the device to process requests sequentially ✅
B.It allows the device to queue several commands and work on them in parallel
C.It reduces the size of each request to fit within cache lines
D.It eliminates the need for error checking
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When a storage device has high latency, issuing several overlapped requests lets the device keep its internal pipelines busy, processing multiple commands without waiting for each to finish. This parallelism raises overall throughput. Option A is the opposite of the intended effect. Option C concerns cache optimization, not latency. Option D ignores the essential role of error handling. Therefore, queuing multiple commands (option B) correctly captures the benefit.

Q6. In a system that uses overlapped I/O, what is the main risk if the programmer forgets to reset the OVERLAPPED structure after each operation?

A.Data may be written to the wrong memory address ✅
B.The CPU will overheat due to excessive context switches
C.The I/O device will shut down automatically
D.Network packets will be duplicated
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The OVERLAPPED structure contains fields such as the offset and event handle that must be reinitialized for each new request. If these fields retain old values, subsequent I/O may target an incorrect buffer location, leading to corrupted data. The other options describe effects that are unrelated to the structure’s state: overheating, device shutdown, and packet duplication are not direct consequences of not resetting the OVERLAPPED fields.

Q7. What advantage does overlapped I/O offer when handling many short network messages in a server application?

A.It guarantees that messages arrive in order ✅
B.It reduces the number of system calls needed to process all messages
C.It allows the server to process other work while each send/receive operation progresses
D.It eliminates the need for socket buffers
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Overlapped I/O enables the server to issue a send or receive request and then continue with other tasks, such as handling additional connections or performing computation, while the network stack completes the transfer. This overlap improves responsiveness. Ordering (option A) is handled by protocols, not by overlapped I/O. Reducing system calls (option B) is more about batching, and socket buffers (option D) remain necessary. Hence, option C correctly describes the benefit.

Q8. A developer writes a program that reads from a disk using overlapped I/O but observes that the read latency does not improve. Which of the following is the most likely cause?

A.The disk controller does not support DMA ✅
B.The program uses a single thread for all operations
C.The file is opened with the FILE_FLAG_NO_BUFFERING flag
D.The buffer size is set to 1 KB
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: If the program issues overlapped reads but processes them sequentially on a single thread, the overlap cannot be exploited because the thread waits for each request before issuing the next. A disk controller that lacks DMA (option A) would still benefit from overlapped requests, albeit less efficiently. FILE_FLAG_NO_BUFFERING (option C) changes caching behavior but does not prevent overlap. Buffer size (option D) influences transfer efficiency but not the ability to overlap. Therefore, using a single thread is the most plausible reason for unchanged latency.

Q9. When designing a real‑time audio playback system, why would you choose overlapped I/O over blocking I/O?

A.Because overlapped I/O guarantees zero‑latency audio output ✅
B.Because it lets the audio thread continue processing while the next buffer is being filled
C.Because it reduces the amount of audio data that must be stored
D.Because it eliminates the need for thread synchronization
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: In real‑time audio, the playback thread must keep feeding the sound device continuously. Overlapped I/O allows the thread to request the next audio buffer and then perform mixing or other work while the hardware reads the current buffer, reducing the chance of glitches. Option A is unrealistic; zero latency cannot be guaranteed. Option B correctly describes the benefit and is the right answer. Options C and D misrepresent the role of I/O overlap.

Q10. A database engine issues four overlapped read requests to a RAID array, each of size 256KB256\text{KB}. If the array can process two requests in parallel, what is the maximum amount of data that can be in transit at any moment?

A.256KB256\text{KB}
B.512KB512\text{KB} ✅
C.768KB768\text{KB}
D.1MB1\text{MB}
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The RAID array can handle two simultaneous requests, each 256KB256\text{KB} in size. Therefore, the total data being transferred concurrently is 2×256KB=512KB2 \times 256\text{KB} = 512\text{KB}. The other options represent either a single request, three requests, or all four requests, which exceed the parallel capacity of the array.

Q11. In a multithreaded file‑copy utility, which design pattern best exploits overlapped I/O to maximize disk throughput?

A.Create one thread per file and use blocking reads ✅
B.Use a thread pool where each thread issues overlapped reads and writes, then returns to the pool
C.Serially copy each file with a single overlapped request per file
D.Combine overlapped I/O with busy‑waiting loops to poll for completion
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The most effective pattern is to have a thread pool that continuously issues overlapped read/write operations and then returns to handle other tasks, keeping the disks busy and the CPU productive. Option A wastes CPU time with blocking calls. Option C limits overlap to a single request per file, underusing the device’s capability. Option D introduces busy‑waiting, which defeats the purpose of asynchronous I/O. Therefore, option B (the thread‑pool approach) is the correct choice.

Q12. A network server uses overlapped I/O with a completion port. If the number of pending I/O operations exceeds the number of worker threads, what is the expected behavior?

A.The server will drop incoming connections ✅
B.The completion port will queue completed I/O events until a thread becomes available
C.The operating system will automatically create more threads
D.The pending I/O operations will be cancelled
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Completion ports are designed to queue completed I/O notifications. When there are more pending operations than worker threads, the system simply holds the completion events in the port’s queue until a thread retrieves them. No connections are dropped (option A), the OS does not spawn extra threads automatically (option C), and pending operations are not cancelled (option D). Hence, the correct description is that the completion port queues events.

Q13. Why might a programmer prefer overlapped I/O over multi‑threaded blocking I/O when reading from a high‑speed sensor?

A.Because overlapped I/O reduces the need for synchronization primitives ✅
B.Because it guarantees that data is always read in the correct order
C.Because it eliminates the possibility of data loss due to buffer overruns
D.Because it allows the same thread to issue new reads while previous ones are still in progress
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Overlapped I/O enables a single thread to start a read operation and then immediately issue another read before the first completes, which is ideal for high‑speed data streams. Option A is partially true but not the primary reason; synchronization is still required for shared resources. Option B is handled by the sensor protocol, not by I/O mode. Option C is unrelated to the overlap mechanism. Therefore, option D best captures the advantage.

Q14. In a graphics rendering engine, which scenario most benefits from using overlapped I/O to load texture data?

A.When textures are tiny and fit entirely in cache ✅
B.When the GPU can render frames while the CPU reads large texture files from disk
C.When the application runs on a single‑core processor with no other work to do
D.When textures are generated procedurally at runtime
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: If the GPU is busy drawing a frame, the CPU can simultaneously issue overlapped reads to fetch large textures from disk, keeping both processors occupied and reducing frame stalls. Tiny textures (option A) load quickly, making overlap unnecessary. A single‑core processor with no other tasks (option C) cannot exploit overlap effectively. Procedural generation (option D) does not involve disk I/O. Thus, option B correctly describes the beneficial scenario.

Q15. What is a common pitfall when using overlapped I/O with sockets on a Windows platform?

A.Forgetting to set the socket to non‑blocking mode ✅
B.Reusing the same OVERLAPPED structure for multiple concurrent operations
C.Using the wrong port number in the bind call
D.Calling closesocket before all I/O completes
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: When multiple overlapped socket operations are in flight, each must have its own distinct OVERLAPPED structure; reusing one leads to race conditions and corrupted state. Setting a socket to non‑blocking (option A) is optional because overlapped I/O already provides asynchronous behavior. Using an incorrect port (option C) causes connection failures but not overlap issues. Closing the socket prematurely (option D) is a mistake but unrelated to the specific overlap pitfall. Hence, option B is the most typical error.

Q16. A file copy program issues overlapped writes with a buffer size of 4KB4\text{KB} to a flash drive that has a erase‑block size of 64KB64\text{KB}. What inefficiency does this cause?

A.The program will exceed the drive’s maximum transfer size ✅
B.The write operations will cause unnecessary erase‑cycle wear
C.The drive will reject the writes because they are too small
D.The program will experience increased latency due to larger buffers
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Flash memory must erase whole blocks before writing. Issuing many small 4KB4\text{KB} writes forces the drive to perform multiple erase‑write cycles for the same 64KB64\text{KB} block, accelerating wear. Option A is incorrect because the drive can accept smaller writes; it internally manages block sizes. Option C is false; the drive accepts sub‑block writes. Option D misattributes latency to buffer size. Therefore, the inefficiency is unnecessary erase‑cycle wear.

Q17. When implementing a logging system that writes to a file using overlapped I/O, why is it important to flush the file handle after a series of writes?

A.Flushing guarantees that data is written to the physical disk, preventing loss if the program crashes
B.Flushing reduces the number of overlapped operations needed ✅
C.Flushing automatically compresses the log data
D.Flushing disables overlapped I/O for the next write
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Even though overlapped I/O queues writes asynchronously, the data may still reside in system buffers. Calling FlushFileBuffers forces the operating system to commit those buffers to the storage medium, ensuring durability in case of a crash. Option B confuses flushing with request count. Option C describes compression, which is unrelated. Option D incorrectly states that flushing disables overlap. Hence, the primary reason is to guarantee persistence.

Q18. In a high‑frequency trading application, which characteristic of overlapped I/O is most critical for meeting strict latency requirements?

A.The ability to process I/O in the kernel without user‑mode involvement ✅
B.The guarantee that I/O will complete within a fixed time window
C.The reduction of context switches by allowing a single thread to handle multiple I/O operations
D.The automatic prioritization of network packets over other traffic
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The application needs to issue many network requests quickly; overlapped I/O lets one thread start several operations and then continue processing, minimizing context switches and keeping latency low. Option A is true but not the decisive factor for latency. Option B is unrealistic; overlapped I/O does not provide deterministic completion times. Option D concerns network QoS, not I/O overlap. Thus, the reduction of context switches (option C) is the most critical attribute.

🔗 Related Topics (MCQs)