Greg wrote:
Guido van Rossum wrote:
The reason we can't ignore IOCP is that it is apparently the *only* way to do async I/O in a scalable way. The only other polling primitive available is select() which does not scale.
There seems to be an alternative to polling, though. There are functions called ReadFileEx and WriteFileEx that allow you to pass in a routine to be called when the operation completes:
http://msdn.microsoft.com/en- us/library/windows/desktop/aa365468%28v=vs.85%29.aspx http://msdn.microsoft.com/en- us/library/windows/desktop/aa365748%28v=vs.85%29.aspx
Is there some reason that this doesn't scale either?
I suspect it's because it has the completion routine is being invoked on the same thread that issued the I/O. The thread has to first block in an alertable wait (e.g. WaitForMultipleObjectsEx or WSAWaitForMultipleEvents). So you'll only get 1 thread doing I/Os and CPU work vs IOCP's where many threads can share both workloads.