[issue35580] Windows IocpProactor: CreateIoCompletionPort 4th arg 0xffffffff -- why is this value the default?

2019-02-16 Thread Jeff Robbins


Jeff Robbins  added the comment:

I don't understand why 0 would be safer.  Since asyncio can only service this 
IOCP from its single threaded event loop, I would have thought 1 would express 
the intent better.  

Why not convey to the OS what we're up to, in case that helps it do a better 
job or reduces resource footprint?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35580] Windows IocpProactor: CreateIoCompletionPort 4th arg 0xffffffff -- why is this value the default?

2019-01-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

>From my understanding the question is: replace 0x with 0 or 1?

I don't know much about IOCP, 0 sounds safer for me.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35580] Windows IocpProactor: CreateIoCompletionPort 4th arg 0xffffffff -- why is this value the default?

2019-01-15 Thread STINNER Victor


STINNER Victor  added the comment:

> Am I correct that only one thread calls `GetQueuedCompletionStatus` on a 
> given `iocp` object in asyncio under Windows `IocpProactor`?

An asyncio event loop must only run in a single thread at the same time. It 
doesn't make sense to run the same event loop multiple times in parallel and it 
is not supported (most asyncio classes are not thread-safe, there is no need to 
be thread-safe).

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35580] Windows IocpProactor: CreateIoCompletionPort 4th arg 0xffffffff -- why is this value the default?

2018-12-24 Thread Jeff Robbins


Jeff Robbins  added the comment:

Per 
https://stackoverflow.com/questions/38133870/how-the-parameter-numberofconcurrentthreads-is-used-in-createiocompletionport,
 it seems that `NumberOfConcurrentThreads` controls what happens when multiple 
threads call `GetQueuedCompletionStatus`.  

But since a given instance of `IocpProactor` only calls 
`GetQueuedCompletionStatus` from a single thread, probably this arg doesn't 
matter, and the value `1` would be more explicit about the pattern asyncio is 
using?  A huge number is, presumably, either not relevant or, at worst, 
wasteful of some kernel resource.  

Am I correct that only one thread calls `GetQueuedCompletionStatus` on a given 
`iocp` object in asyncio under Windows `IocpProactor`?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35580] Windows IocpProactor: CreateIoCompletionPort 4th arg 0xffffffff -- why is this value the default?

2018-12-24 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

The value type is DWORD.

0x is a maximum allowed value for DWORD.

0 implies something like 8 for Intel i7.

I don't remember the reason (the value was present is very first proactor 
implementation and never changed after it).

Maybe giving Windows a privilegy to decide what number of IO threads is optimal 
is not a bad idea, I don't know.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35580] Windows IocpProactor: CreateIoCompletionPort 4th arg 0xffffffff -- why is this value the default?

2018-12-24 Thread Jeff Robbins


New submission from Jeff Robbins :

By default, the __init__ function of IocpProactor in windows_events.py calls 
CreateIoCompletionPort with a 4th argument of 0x, yet MSDN doesn't 
document this as a valid argument.
https://docs.microsoft.com/en-us/windows/desktop/fileio/createiocompletionport

It looks like the 4th arg (NumberOfConcurrentThreads) is meant to be either a 
positive integer or 0.  0 is a special value meaning "If this parameter is 
zero, the system allows as many concurrently running threads as there are 
processors in the system."

Why does asyncio use 0x instead as the default value?

--
components: asyncio
messages: 332498
nosy: asvetlov, je...@livedata.com, yselivanov
priority: normal
severity: normal
status: open
title: Windows IocpProactor: CreateIoCompletionPort 4th arg 0x -- why 
is this value the default?
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com