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
Suspend runtime #3129
Merged
Merged
Suspend runtime #3129
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 reverts commit a772ea8.
…dlock during exceptional shutdown Previously stop_locked would block on calling resume_internal, even if blocking was set to false. This lead to deadlocks when multiple threads call stop_locked and assume that only one of them has blocking set to true.
Wrong function name passed to HPX_THROWS_IF
- Make sure there is an idle thread which can do the stealing - Add comments to warn about corner cases
Change state_suspended to state_sleeping.
I.e. don't use pending_boost to let other work run first.
Add two new functions to the hpx namespace: - suspend - resume and corresponding functions to threadmanager. These two currently more or less wrap the threadmanager suspend/resume calls and check the runtime status.
io_service_pool::wait removes the work guard from the io_services so that they finish when done, waits for all io_service.run()s to return, and then restarts them so that they accept work again.
Don't allow suspension when number of localities > 1.
- Wait for runtime to start before suspending - Remove hpx_main - Clean up includes
hkaiser
approved these changes
Feb 2, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This PR is a high risk change as it touches on the scheduling loop. We have to be very careful with merging it. |
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.
Part of #3003.
Proposed Changes
Add
hpx::suspend
andhpx::resume
functionshpx::suspend
blocks waiting for all pools to finish their workhpx::resume
blocks waiting for pools to resumeAdd a
wait
function toio_service_pool
which waits for theio_service
s to finish their work. Asio_services
stay idle when they have no work,hpx::suspend
only waits forio_service_pool
s to be empty.This uses Suspend thread pool #3110 and Add hpx::start nullptr overloads #3127. They should be merged first.
Any background context you want to provide?
The API is now a lot simpler that initially suggested in #3003, to not complicate the use of
hpx::start/init/stop
further. This also makes the implementation simpler. If a "smarter" API is needed in the future it can be built on top of this, but this is enough as a start.The
resume/suspend
in this PR is faster thanstart/stop
, but not significantly. I will still need to optimize that part to make this useful for small blocks of work, but will do that in a separate PR.