You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
This should be possible on MacOS, just need to implement & test
The text was updated successfully, but these errors were encountered: