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

Added method to set thread affinity for a certain core #140

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

firesurfer
Copy link
Contributor

Hi,
this PR adds an additional method which allows "binding" the calling thread to a certain core. In fact it sets the thread affinity to a certain core.

Even though @fmauch figured out in his tests (https://github.com/UniversalRobots/Universal_Robots_ROS_Driver/blob/60f08359f6/ur_robot_driver/doc/real_time_benchmarking.md) that setting the core affinity didn't change to much for his system, this can not be assumed in general. (See https://stackoverflow.com/questions/24645880/set-cpu-affinity-when-create-a-thread for a nice write up) Especially for more heterogene systems like the AMD Ryzen processes with 3D cache which is only connected to one processor die tying a thread to a certain core makes sense.
Having the scheduler preferre a certain core for a certain thread can reduce cache misses and avoid context switches.

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.

2 participants