Link Copied
Thread affinity is performed in software. The application requests the operating system to restrict the scheduling to one or more processors usualy by way of a bit mask (but some O/S use other data structures to specify the desired affinity). Most O/S's have a bit mask of permitted processor(s) while some O/S's also have a preferred processor mask as well as other selection chriteria.
The restriction can be simple or complex depending on the O/S
Only processor(s) selected by bitmask (or list if list based)
Preference for processor(s) selected by bitmask (or list if list based)
Processor(s) sharing the same cache
Processor(s) NOT sharing the same cache
Processor(s) in the same package
Processor(s) NOT in the same package
Processor(s) in the same NUMA node
Processor(s) NOT in the same NUMA node
etc...
For more complete information about compiler optimizations, see our Optimization Notice.