HOME

TheInfoList



OR:

An affinity mask is a bit mask indicating what processor(s) a
thread Thread may refer to: Objects * Thread (yarn), a kind of thin yarn used for sewing ** Thread (unit of measurement), a cotton yarn measure * Screw thread, a helical ridge on a cylindrical fastener Arts and entertainment * ''Thread'' (film), 2016 ...
or process should be run on by the scheduler of an operating system. Setting the affinity mask for certain processes running under Windows can be useful as there are several system processes (especially on domain controllers) that are restricted to the first CPU / Core. So, excluding the first CPU might lead to better application performance.


Windows API

Thread affinity in
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
can be specified with the ''SetThreadAffinityMask'' function. Forcing of each OpenMP thread to distinctive cores in Windows can be accomplished by means of the following C code: #include #include // Set OpenMP thread affinity void set_thread_affinity ()


See also

* Processor affinity


References


External links


MSDN article on SetThreadAffinityMask functionCPU Balancer, a free, open-source utility that distributes Windows XP processes uniformly over logical processors using the affinity mask
Job scheduling {{operating-system-stub