Processor affinity

Processor affinity

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 to others.

Processor affinity takes advantage of the fact that some remnants of a process may remain in one processor's state (in particular, in its cache) from the last time the process ran, and so scheduling it to run on the same processor the next time could result in the process running more efficiently than if it were to run on another processor. Actual scheduling algorithm implementations vary in how strongly they will adhere to processor affinity. Under certain circumstances some implementations will allow a task to change to another processor if this is deemed to be most efficient under the circumstances. An obvious example involves two processor-intensive tasks (A & B) having affinity to one processor while another processor lies unused. Many algorithms would shift task B to the second processor in order to maximize processor utilization. Task B would then acquire affinity with the second processor while task A would continue to have affinity with the original processor.

Processor affinity can effectively reduce cache problems but it does not curb the persistent load-balancing problem. [ [ White Paper - Processor Affinity] - From [] . Accessed 2007-07-06.]

Processor affinity becomes more complicated in systems with non-uniform architectures. As an example, a system with two dual-core hyper-threaded CPUs presents a challenge to a scheduling algorithm. There is complete affinity between two virtual CPUs implemented on the same core via hyper-threading; partial affinity between two cores on the same physical chip (as the cores share some, but not all, cache), and no affinity between separate physical chips.

Processor affinity alone cannot be used as the basis for dispatching processes to specific CPUs, however, as other resources are also shared. For instance, if a process has recently run on one virtual hyper-threaded CPU in a given core, and that virtual CPU is currently busy but its partner is not, cache affinity would suggest that the process should be dispatched to the idle partner. However, since the two virtual CPUs compete for essentially all computing, cache, and memory resources, it would typically be more efficient to dispatch the process to a different core or CPU if one is available; while this would likely incur a penalty in that the process would have to repopulate the cache, overall performance would likely be higher as the process would not have to compete for resources such as functional units within the CPU.

On Linux the CPU affinity of a process might be altered with the taskset(1) program. [ [ taskset] - From " [] ". Accessed 2007-07-06.] On SGI systems, [ dplace] binds a process to a set of CPUs. [ [ dplace.1] - From " [] ". Accessed 2007-07-06.] On Windows NT, thread and process CPU affinities can be set separately by using SetThreadAffinityMask [ [ SetThreadAffinityMask] - MSDN Library] and SetProcessAffinityMask [ [ SetProcessAffinityMask] - MSDN Library] API calls or can set each process's affinity via the Task Manager interface.

See also

* Affinity mask


Wikimedia Foundation. 2010.

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

Look at other dictionaries:

  • Affinity — Affinity, in etymology affinity is the opposite of infinity . These two words have the same root coming from the Latin: finis = end . “Affinity” meaning is near to the “finis” e.g. close to the “zero point” in a before assumed space. On the other …   Wikipedia

  • 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… …   Wikipedia

  • Low-affinity nerve growth factor receptor — P75 redirects here. For the New Testament manuscript, see Papyrus 75. For Pentium processor at 75 MHz, see Intel P5 (microarchitecture). Nerve growth factor receptor PDB rendering based on 1sg1 …   Wikipedia

  • OpenMP — Original author(s) OpenMP Architecture Review Board[1] Developer(s) OpenMP Architecture Review Board …   Wikipedia

  • Windows XP — Windows Experience redirects here. For Windows Experience Index, see Windows System Assessment Tool. Windows XP Part of the Microsoft Windows family …   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

  • CPU shielding — is a practice where on a multiprocessor system or on a CPU with multiple cores, real time tasks can run on one CPU or core while non real time tasks run other other.The operating system must be able to set a CPU affinity for both processes and… …   Wikipedia

  • Scheduling algorithm — In computer science, a scheduling algorithm is the method by which threads, processes or data flows are given access to system resources (e.g. processor time, communications bandwidth). This is usually done to load balance a system effectively or …   Wikipedia

  • .NET Compact Framework — The Microsoft .NET Compact Framework (.NET CF) is a version of the .NET Framework that is designed to run on resource constrained mobile/embedded devices such as personal digital assistants (PDAs), mobile phones, factory controllers, set top… …   Wikipedia

  • Loi d'Amdahl — Évolution du gain en vitesse d exécution d un programme en fonction du nombre de processeurs pour différentes valeurs de 1 s selon la Loi d Amdahl La loi d Amdahl, énoncée par Gene Amdahl, exprime le gain de performance qu on peut attendre d un… …   Wikipédia en Français

Share the article and excerpts

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