关于Win32中IO completion port的一点理解

I/O completion port是微软号称目前为止最好(performance,scalability,throughput,etc.)的I/O处理机制。MSDN关于它的运行机制、performance等写道:

The most efficient scenariooccurs when there are completion packets waiting in the queue, but no waits canbe satisfied because the port has reached itsconcurrency limit.

No thread context switches will occur, becausethe running thread is continually picking up completion packets and the otherthreads are unable to run.

       “The best overall maximumvalue to pick for the concurrencyvalue is the number of CPUs on the computer.

       “Threads that block theirexecution on an I/O completion port are released inlast-in-first-out (LIFO) order, and the next completion packet ispulled from the I/O completion port's FIFO queue for that thread.

       I/OCompletion Port的显著特点有:

l  尽量减少thread context switches。

l  尽量只让一个thread去工作,而宁愿让一些completion消息等待处理,宁愿让其他的threads去休息。

l  理论上只要CPU个数的worker threads即可:这种情况下,如果有成千上万的completion消息在等待处理,I/O CompletionPort仍然不会生成更过的threads去服务他们,相反的,I/O Completion Port认为:这时,CPU个数的threads已经全力以赴,马不停蹄,没有任何的context switches,占用了所有的CPU资源,已经达到了系统的最大处理能力。如果再增加threads,则会增多contextswitches,反而降低了系统处理实际任务的能力和效率。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值