about
3/04/2022
Platform IO
BasicBites - Platform IO
Synchronous, asynchronous, buffered, unbuffered
- Synchronous I/O uses functions that don"t return until the operation completes. Programming language libraries provide read and write functions for that purpose.
- Asynchronous I/O uses functions that supply a call back function and return immediately. The callback is invoked when the operation completes. Programming language libraries provide async read and async write functions for that purpose.
I/O Completion Ports
Async Await
related details
Windows Messaging
Streams
Consequences
- Synchronous I/O requires the handling thread to block until completion so operations that may block for a long time, like network communications, will adversely affect program performance if handled on the main thread of execution.
- Asynchronous I/O allows the requesting thread to return immediately, but increases the overall processing load on machine's cores due to creation of I/O completion object and dispatching to thread pool threads.
- Unbuffered I/O sends each request to the kernel for processing by a device driver. For infrequent requests this requires no addition processing at the expense of more (infrequent) system calls.
- Buffered I/O collects a series of I/O requests before entering the kernel, resulting in fewer expensive operations, but incurs the buffering overhead.