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

Support specifying worker thread affinities #146

Merged
merged 2 commits into from
Jun 5, 2020

Conversation

ben-clayton
Copy link
Contributor

Add Thread::Affinity which describes the cores on which a thread can
execute.

Add Thread::Affinity::Policy which generates an Affinity for a
thread by identifier. Policy contains two helper functions that return
Policy implementations:

  • anyOf() returns a Policy that returns an Affinity for the
    available cores in the Affinity passed to the function.
  • oneOf() returns a Policy that returns an affinity with a single
    enabled core from the Affinity passed to the function.

Other Policys can be implemented by the user.

Add a new affinityPolicy field to Scheduler::Config allowing the
user to specify the rules for assigning thread affinities to each
scheduler worker thread.

Affinities are currently only supported on windows, linux and freebsd.

Issue: #136

@ben-clayton ben-clayton force-pushed the thread-affinity-policy branch 3 times, most recently from 1159c99 to a7148df Compare June 4, 2020 18:28
Add const flavors of `front()`, `back()`, `begin()`, `end()`.
@ben-clayton ben-clayton force-pushed the thread-affinity-policy branch from a7148df to 7b2e43f Compare June 4, 2020 19:43
@ben-clayton ben-clayton marked this pull request as ready for review June 4, 2020 20:54
@ben-clayton ben-clayton force-pushed the thread-affinity-policy branch from 7b2e43f to e0ea5ee Compare June 5, 2020 16:10
Add `Thread::Affinity` which describes the cores on which a thread can
execute.

Add `Thread::Affinity::Policy` which generates an `Affinity` for a
thread by identifier. `Policy` contains two helper functions that return
`Policy` implementations:
 * `anyOf()` returns a `Policy` that returns an Affinity for the
   available cores in the `Affinity` passed to the function.
 * `oneOf()` returns a `Policy` that returns an affinity with a single
   enabled core from the `Affinity` passed to the function.

Other `Policy`s can be implemented by the user.

Add a new `affinityPolicy` field to `Scheduler::Config` allowing the
user to specify the rules for assigning thread affinities to each
scheduler worker thread.

Affinities are currently only supported on windows, linux and freebsd.

Issue: google#136
@ben-clayton ben-clayton force-pushed the thread-affinity-policy branch from e0ea5ee to 77e34d1 Compare June 5, 2020 21:31
@ben-clayton
Copy link
Contributor Author

#147 contains these changes and was approved my @AWoloszyn. Landing.

@ben-clayton ben-clayton merged commit 325b072 into google:master Jun 5, 2020
@ben-clayton ben-clayton deleted the thread-affinity-policy branch June 5, 2020 21:45
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.

1 participant