Affinity mask

Affinity mask

An Affinity Mask is a bit mask indicating what processor(s) a thread 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 several system processes (especially on domain controllers) 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 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 () { #pragma omp parallel default(shared) { DWORD_PTR mask = (1 << omp_get_thread_num()); SetThreadAffinityMask( GetCurrentThread(), mask ); } }

See also

* Processor affinity

External links

* [http://msdn.microsoft.com/en-us/library/ms686247(VS.85).aspx MSDN article on SetThreadAffinityMask function]
* [http://www.linuxcommand.org/man_pages/taskset1.html Taskset, a tool to set the affinity mask on Linux]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Mask (disambiguation) — A mask is an artifact normally worn on the face, typically for protection, concealment, performance, or amusement. The word can also refer to: In computing and technology Affinity mask, a bit mask indicating what processor a thread or process… …   Wikipedia

  • Mask (computing) — Signal masking redirects here. For other uses, see Masking (disambiguation). In computer science, a mask is data that is used for bitwise operations. Using a mask, multiple bits in a byte, nibble, word (etc.) can be set either on, off or inverted …   Wikipedia

  • Affinity Group — Die Antikriegs Affinity Group „Collateral Damage“. Alle sieben wurden am 4. Dezember 2002 wegen der Besetzung des Büros von Senator Allard aus Protest gegen den bevorstehenden Irakkrieg verurteilt.[1] Eine Affinity Group, im deutschen überwiegend …   Deutsch Wikipedia

  • Processor affinity — is a modification of the native central queue scheduling algorithm.Each task (be it process or thread) in the queue has a tag indicating its preferred / kin processor.At allocation time, each task is allocated to its kin processor in preference… …   Wikipedia

  • Character mask — Part of a series on Marxism …   Wikipedia

  • Load balancing (computing) — Load balancing is a computer networking methodology to distribute workload across multiple computers or a computer cluster, network links, central processing units, disk drives, or other resources, to achieve optimal resource utilization,… …   Wikipedia

  • List of House of Night characters — A list of all the characters in the House of Night series written by P. C. Cast and Kristin Cast. Contents 1 Fledglings 1.1 Zoey Redbird 1.1.1 Love life 1.2 Damien Maslin …   Wikipedia

  • Southeast Asian arts — Literary, performing, and visual arts of Myanmar (Burma), Thailand, Laos, Cambodia, Vietnam, Malaysia, Singapore, and the Philippines. The classical literatures of Southeast Asia can be divided into three major regions: the Sanskrit region of… …   Universalium

  • arts, East Asian — Introduction       music and visual and performing arts of China, Korea, and Japan. The literatures of these countries are covered in the articles Chinese literature, Korean literature, and Japanese literature.       Some studies of East Asia… …   Universalium

  • Up Against the Wall Motherfuckers — (often referred to as simply the Motherfuckers , or UAW/MF) was an anarchist affinity group based in New York City. This street gang with analysis was famous for its Lower East Side direct action and is said to have inspired members of the… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”