-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Scheduler multithreading #6821
Closed
Closed
Scheduler multithreading #6821
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is used for signalling the event loop from other threads.
This will be for implementing a work-sharing strategy
Just a simple place to stuff handles to sleeping schedulers.
…infinite recursion
Conflicts: src/libstd/rt/sched.rs
This also pulls in one of @Aatch's patches to add atomic ints. In the meantime he's upstreamed a more complete implementation. I'll switch the scheduler over and delete this version later. |
This isn't utilizing all threads effectively. Still investigating. |
I'm going to hold on to this for a while to work out some kinks. |
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Mar 25, 2021
…p1995 Write literal suggestion fixes: rust-lang#6768 changelog: Add suggestion to `write_literal` and `print_literal` lints changelog: Change `use_debug` to point only at the format string
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
r? @nikomatsakis
This implements very basic multithreading in the new scheduler. This is only using a trivial work sharing strategy with a shared task queue. It adds three new concurrent types to the scheduler:
WorkQueue
,MessageQueue
, andSleeperList
.WorkQueue
is temporarily just a basic queue;MessageQueue
is a multiple-producer, singe-consumer queue for sending messages to schedulers, andSleeperList
is a shared stack used for waking up sleeping schedulers. All three are intended to be lock free but for now are implemented naively with locks.The main scheduling routine, which uses all three of these data structures is here: https://github.com/brson/rust/blob/io-upstream/src/libstd/rt/sched.rs#L144
An example of how the multithreaded scheduler is constructed: https://github.com/brson/rust/blob/io-upstream/src/libstd/rt/test.rs#L62
#4419