关闭

Overlapped I/O from wikipedia

标签: IOCPlua tcpluasocketlua网络通信socket
464人阅读 评论(0) 收藏 举报
分类:

 

 

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模型

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:128580次
    • 积分:2597
    • 等级:
    • 排名:第14700名
    • 原创:120篇
    • 转载:4篇
    • 译文:21篇
    • 评论:11条
    最新评论