I am looking for a function on Mac OS and BSD that is equivalent to Linux sched_getcpu()and Windows' GetCurrentProcessorNumberEx()to implement a library for local cpu storage. Obviously, you can imitate this using the cpuid or rdtscp instructions, but it is better to work with kernel cooperation: https://lkml.org/lkml/2007/1/6/190 .
I already know that the current processor of the processor may change by the time this information is used.
source
share