Definition
IO Buffering
IO buffering uses main memory as temporary storage during IO operations, decoupling process speed from device speed.
Strategies
No Buffering
Process waits for IO to complete directly in user memory. Inefficient for slow devices.
Single Buffering
OS allocates one kernel buffer. While the process processes the current block, the OS reads the next block into the buffer.
Double Buffering (Buffer Swapping)
OS uses two buffers. The IO device fills one while the process consumes from the other. When both finish, buffers swap. Maximises parallelisation.
Circular Buffering
Uses more than two buffers in a ring. Effective for bursty IO where processing and IO speeds vary significantly.
Benefits
Transaction Batching
Collects individual characters into larger blocks before transfer, reducing the number of IO operations.
Decoupling
Separates process access times from device transfer times. The OS can schedule transfers efficiently without blocking the application.
Peak Masking
Buffers absorb bursty IO activity, allowing the process to run at memory speed until the buffer saturates.
Swapping Support
Allows a process to be swapped out while its IO operation remains in progress (OS manages the buffer).