Skip to content

win,libuv: support multiple threads #32211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2019
Merged

win,libuv: support multiple threads #32211

merged 1 commit into from
Jun 3, 2019

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented May 31, 2019

turns off the "do not work" flag

fix #32087

turns off the "do not work" flag

fix #32087
@vtjnash vtjnash added system:windows Affects only Windows io Involving the I/O subsystem: libuv, read, write, etc. multithreading Base.Threads and related functionality labels May 31, 2019
@@ -1,2 +1,2 @@
LIBUV_BRANCH=julia-uv2-1.24.0
LIBUV_SHA1=2348256acf5759a544e5ca7935f638d2bc091d60
LIBUV_SHA1=26dbe5672c33fc885462c509fe2a9b36f35866fd
Copy link
Member Author

@vtjnash vtjnash May 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Keno
Copy link
Member

Keno commented Jun 1, 2019

As I commented on the relevant commit somewhere. I don't think this fix is sufficient in the presence of more threads than the number of cores in the machine. The problem is that threads retain their completion port association, but we migrate the completion port to a different thread. Ideally we'd have a way to drop that association and keep this value as is.

@JeffBezanson
Copy link
Member

That makes sense, but in the meantime this is a much-needed improvement. It makes the difference between simple threaded code locking up every time vs. generally working.

@vtjnash
Copy link
Member Author

vtjnash commented Jun 3, 2019

That's something to consider in the future, although hopefully less of a concern, since any blocking call to the kernel should enable releasing a new thread from the IOCP. If we do continue with the current IO design unchanged, there is a way that this should be addressable per the MSDN documentation:

Although any number of threads can call GetQueuedCompletionStatus for a specified I/O completion port, when a specified thread calls GetQueuedCompletionStatus the first time, it becomes associated with the specified I/O completion port until one of three things occurs: The thread exits, specifies a different I/O completion port, or closes the I/O completion port. In other words, a single thread can be associated with, at most, one I/O completion port.

@JeffBezanson JeffBezanson merged commit 9dceb46 into master Jun 3, 2019
@JeffBezanson JeffBezanson deleted the jn/32087 branch June 3, 2019 17:27
@Keno
Copy link
Member

Keno commented Jun 3, 2019

Can we just set that value to something like typemax? Are there any resources allocated proportional to that value? If not, setting it really high is probably a solution, since we can't allocate that many threads anyway.

vtjnash added a commit to JuliaPackaging/Yggdrasil that referenced this pull request Jun 14, 2019
staticfloat added a commit that referenced this pull request Jun 19, 2019
JeffBezanson pushed a commit that referenced this pull request Jun 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
io Involving the I/O subsystem: libuv, read, write, etc. multithreading Base.Threads and related functionality system:windows Affects only Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

repeated threads loop hangs on windows
3 participants