Problem Statement
Explain buffering in I/O systems: why is it used and what are its trade-offs?
Explanation
Buffering is the technique of using a temporary memory area (buffer) to hold data while it is transferred between two devices or between device and memory. It helps decouple producer and consumer speeds (for example when a fast CPU writes to a slower peripheral). Buffering improves throughput, smooths bursts of data and reduces I/O invocation overhead. On the flip side, buffering consumes memory, can introduce latency (data waits in buffer), may cause inconsistency if not flushed correctly, and adds complexity (flush logic, overflow, memory management). Interviewers like it when you discuss both the benefit and trade-offs.
