Skip to content

fix(rt): bring back dynamic machines #748

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
Apr 12, 2020
Merged

Conversation

dignifiedquire
Copy link
Member

Even if we do not make use of the progress blocking, we do need to make use of the dynamic restarting of machines as far as I understand.

Keeps the perf, while removing the regression from #747

Even if we do not make use of the progress blocking, we do need to make use of the dynamic restarting of machines as far as I understand.

Keeps the perf, while removing the regression from #747

// Sleep for a bit longer if the scheduler state hasn't changed in a while.
if idle > 10 {
delay = (delay * 2).min(10_000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is perhaps crossbeam utils BackOff a better fit here than rolling it by hand?

Copy link
Member Author

Choose a reason for hiding this comment

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

I figured if it was good enough for @stjepang it'll be good enough for me for now ;)

@k-nasa
Copy link
Member

k-nasa commented Apr 10, 2020

@dignifiedquire
What is the cost of starting a thread?
The reason I removed the mechanism to increase or decrease the number of threads is to temporarily omit those discussions.

I think it's good to start a thread when you need it and close it when it's no longer needed.

@win-t
Copy link

win-t commented Apr 10, 2020

@dignifiedquire
What is the cost of starting a thread?
The reason I removed the mechanism to increase or decrease the number of threads is to temporarily omit those discussions.

I think it's good to start a thread when you need it and close it when it's no longer needed.

can we cache the thread? make the thread is just park instead of terminating it, then when a new thread is needed just unpark it and assume this thread is a fresh one and make sure no resource leak to the new thread (reinitialize all TLS), something like this

loop {
  main_loop();
  invalidate_tls();
  if push_to_cache(thread::current()) {
    thread::park();
  } else {
    break;
  }
}

@dignifiedquire
Copy link
Member Author

I agree we should investigate parking, but for now this is the original logic and fixes the brokeness on master

@dignifiedquire dignifiedquire merged commit b446cd0 into master Apr 12, 2020
@dignifiedquire dignifiedquire deleted the fix/scheduler-2 branch April 12, 2020 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants