8000 Implement for MacOS · Issue #2 · elast0ny/affinity · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement for MacOS #2

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

Open
elast0ny opened this issue Oct 2, 2021 · 1 comment
Open

Implement for MacOS #2

elast0ny opened this issue Oct 2, 2021 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@elast0ny
Copy link
Owner
elast0ny commented Oct 2, 2021

This should be possible on MacOS, just need to implement & test

@elast0ny elast0ny added enhancement New feature or request help wanted Extra attention is needed labels Oct 2, 2021
@StephanvanSchaik
Copy link

I have some experience with the different affinity APIs since I wrapped them in C a while back. The affinity API for Mac OS X is documented here and more specifically one needs to use the thread_policy_set function to set the affinity.

However, Mac OS X does not support setting the CPU affinity explicitly, as in you cannot pin a thread to a particular core. Instead Mac OS X uses an implicit model where you can assign tags to threads such that if they are distinct they are guaranteed to run on different CPU cores by the scheduler. Furthermore, if you want to run a thread on each CPU core, you have to create as many threads as there are CPU cores and assign each thread a unique tag.

I think the way forward here is to add the required definitions to the mach2 crate, since it does not seem to support thread_policy_set yet, and then either offer both the explicit and the implicit model, or simply implement the implicit model as a hybrid model, where the tags can be the actual CPU core IDs on platforms where the explicit model is supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants
0