sunning9001的专栏

而今漫步从头越,苍山如海,残阳如血

Overlapped I/O from wikipedia

 

 

Overlapped I/O is an asynchronous I/O extension of the Windows APIs, which was introduced in Windows NT.
Utilizing overlapped I/O requires passing an OVERLAPPED structure to API functions that normally block, including  Winsock 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 a large number of  sockets.
Overlapped I/O is particularly useful for sockets . It is not well supported in Windows 9x.
The Unix equivalent of overlapped I/O is the POSIX asynchronous I/O API (AIO).

 

Overlapped I/O 是Windows API的一个异步I/O操作的拓展.在Windows NT中被引入.
使用Overlapped I/O 需要传递一个 OVERLAPPED structure 到 创建socket 参数中,以及Winsock WSASend() and WSARecv() 函数中.
被OVERLAPPED struct 初始化的WSASend() and WSARecv() 函数调用时,会立刻返回.并且通过操作系统在背后完成.
函数调用者可以指定一个Win32 Event Handle  解决 I/O 操作完成时的事件.
程序也可以通过完成端口来接收到一个I/O操作完成的通知.当在一个多核系统中处理大量socket事件通过I/O完成端口来接收I/O操作完成事件是首先选择的方法.
Overlapped I/O 对于Socket特别有用途.但是在windows 9x中支持的不是很好.
在Unix系统中, The POSIX asychronous I/O (AIO) 和Overlapped I/O功能差不多.

 

小结: Overlapped I/O 实质上就是一种异步I/O模型,在Unix 系统中为AIO模型

阅读更多
个人分类: windows socket
上一篇Mina 起源和作者简介
下一篇The Reactor pattern 目的和优点
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭