Skip to content
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

Automatically add threads when calling @spawn #32770

Closed
tknopp opened this issue Aug 2, 2019 · 6 comments
Closed

Automatically add threads when calling @spawn #32770

tknopp opened this issue Aug 2, 2019 · 6 comments
Labels
multithreading Base.Threads and related functionality

Comments

@tknopp
Copy link
Contributor

tknopp commented Aug 2, 2019

When starting Julia with only one thread and calling @spawn, no additional thread is created. I know that this is because the number of threads is currently static so take this as a feature request, how I would expect the system to work in an ideal world.

@mbauman
Copy link
Member

mbauman commented Aug 2, 2019

The pre-requisite here is #16134.

@mbauman mbauman added the multithreading Base.Threads and related functionality label Aug 2, 2019
@JeffBezanson
Copy link
Member

This isn't what @spawn means; it's not for creating hardware threads but for exposing parallelism to whatever threads are available. I think this can be combined with #16350, as a request for threading features for interactivity.

@tknopp
Copy link
Contributor Author

tknopp commented Aug 2, 2019

responded to the spawn meaning on discourse: https://discourse.julialang.org/t/threading-1-3-success-story/27111/6

@mbauman
Copy link
Member

mbauman commented Aug 2, 2019

Is not the point here that there are program structures that demand either pre-emptive (software) threads or hardware threads and would otherwise deadlock? Whether or not we call that @spawn, do we want to support this more directly (beyond just @assert nthreads() > 1)?

@StefanKarpinski
Copy link
Member

There's always the radical alternative of using LD_PRELOAD to replace all blocking libc calls with versions that yield back into the Julia scheduler. No threads required.

@JeffBezanson
Copy link
Member

Is not the point here that there are program structures that demand either pre-emptive (software) threads or hardware threads and would otherwise deadlock?

Yes, of course such programs exist. Adding a pthread_create-style API would take things in a violently different direction, but I suppose it's not out of the question. However I closed this because @spawn can't be the interface to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multithreading Base.Threads and related functionality
Projects
None yet
Development

No branches or pull requests

4 participants