c++ - Understanding Windows IOCP and Overlapped IO: Order of Completion and Message Sequencing - Stack Overflow

I have two questions regarding Windows IOCP (IO Completion Ports) and Overlapped IO:1. Order of Asyn

I have two questions regarding Windows IOCP (I/O Completion Ports) and Overlapped I/O:

1. Order of Asynchronous I/O Operations: In Jeffrey Richter's book Windows Via C/C++, the following statement is made:

"You should be aware of a couple of issues when performing asynchronous I/O. First, the device driver doesn't have to process queued I/O requests in a first-in first-out (FIFO) fashion."

This implies that when calling Overlapped I/O functions, the operations might not be processed in the order they were initiated. Here's an example:

// part of iocp tcp server
WSASend( ... ); // 1
WSASend( ... ); // 2
WSASend( ... ); // 3

Is Windows allowed to process the WSASend calls out of the order in which they were called? However, since TCP inherently guarantees message order, how is message sequencing ensured when using Overlapped I/O functions?

2. Completion Notification Order in IOCP: It's mentioned that in IOCP model servers, completion notifications might not arrive in the order the I/O was initiated. However, in my experience with IOCP servers, I've never encountered out-of-order message delivery.

  • Why doesn't the completion notification order guarantee the sequence of operations?
  • If the completion notifications are not in order, how is the message order still maintained?

I appreciate any insights or explanations that could help clarify these points!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742378027a4432581.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信