This article includes a list of general references, but it lacks sufficient corresponding inline citations. Please help to improve this article by introducing more precise citations. (March 2010) (Learn how and when to remove this message) |
Overlapped I/O is a name used for asynchronous I/O in the Windows API. It was introduced as an extension to the API in Windows NT.
Utilizing overlapped I/O requires passing an OVERLAPPED
structure to API functions that normally block, including ReadFile()
, WriteFile()
, and Winsock's WSASend()
and WSARecv()
. The requested operation is initiated by a function call which returns immediately, and is completed by the OS in the background. The caller may optionally specify a Win32 event handle to be raised when the operation completes. Alternatively, a program may receive notification of an event via an I/O completion port, which is the preferred method of receiving notification when used in symmetric multiprocessing environments or when handling I/O on numerous files or sockets. The third and the last method to get the I/O completion notification with overlapped IO is to use ReadFileEx()
and WriteFileEx()
, which allow the User APC routine to be provided, which will be fired on the same thread on completion (User APC is the thing very similar to Unix/POSIX signal, with the main difference being that the signals are using signal numbers from the historically predefined enumeration, while the User APC can be any function declared as "void f(void* context)
"). The so-called overlapped API presents some differences depending on the Windows version used.
Asynchronous I/O is particularly useful for sockets and pipes.
Unix and Linux implement the POSIX asynchronous I/O API (AIO).
References
- "Socket overlapped I/O versus blocking/nonblocking mode". Archived from the original on 2018-05-03.
External links
- MSDN Reference: ReadFile()
- MSDN Reference: WriteFile()
- MSDN Reference: OVERLAPPED Data structure
- I/O Completion Port
This Microsoft Windows article is a stub. You can help Misplaced Pages by expanding it. |