[issue16175] Add I/O Completion Ports wrapper

Antoine Pitrou report at bugs.python.org
Tue Oct 9 23:16:12 CEST 2012


Antoine Pitrou added the comment:

> According to http://msdn.microsoft.com/en-us/library/aa365198%28VS.85%
> 29.aspx once you call GetQueuedCompletionStatus() your thread is
> managed by the IOCP and only up to a given parameter of those threads
> are allowed to run.  They recommend setting that parameter to the
> number of CPUs.  This feels scary (doubly so in the light of the GIL).

I think this mostly means that you should always call
GetQueuedCompletionStatus() from the same thread for a given IO
completion port. Which, in the context of a single-threaded event loop,
shouldn't be a problem (also, this can be enforced by our stdlib
wrapper).

AFAIU, the MSDN docs have this complicated language about threads mostly
because they suggest you to use as many threads as there are CPUs on the
machines (in order to max out the I/O processing bandwidth).

By the way, I've just checked: the Twisted IOCP reactor uses a single
I/O completion port to which it registers all socket handles, and its
event loop calls GetQueuedCompletionStatus() in a loop.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16175>
_______________________________________


More information about the Python-bugs-list mailing list