Affinities

By default, Windows Vista uses soft affinity when assigning threads to processors. This means that if all other factors are equal, it tries to run the thread on the processor it ran on last. Having a thread stay on a single processor helps reuse data that is still in the processor’s memory cache.

There is a computer architecture called NUMA (Non-Uniform Memory Access) in which a machine consists of several boards. Each board has its own CPUs and its own bank of memory. The following figure shows a machine with three boards in it, with each board having 4 CPUs, making 12 CPUs available so that any single thread can run on any of the 12 CPUs.

A NUMA system performs best when a CPU accesses the memory that is on its own board. If the CPU ...

Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.