Does setting a program to have affinity for certain processor thread improve performance?

andrei December 2, 2011
Pinterest Stumbleupon Whatsapp
Ads by Google

I have a Core i3 processor on my laptop featuring two cores, each with two threads. I have read some instructions claiming that setting a process to have affinity for one of the 4 threads can improve performance. If I tweak software to have affinity for one particular thread, will it actually improve performance?

  1. Anonymous
    December 3, 2011 at 11:28 am

    Getting More Bang Out of Your Dual Processing Buck
    http://www.tomshardware.com/reviews/bang-dual-processing-buck,815.html

    programmatically picking which core or cores my application will run on, now that’s real power
    http://www.techrepublic.com/blog/programming-and-development/set-processor-affinity-programmatically-in-a-multi-core-system/691

  2. Jeff Fabish
    December 3, 2011 at 1:05 am

    Actually, your CPU can handle an unlimited amount of threads, or at least until the sum of those threads consume all available memory. A thread is a line of execution for a particular process, so a given program may have five threads open performing different tasks. However, each core can only execute a single instruction in a given tick, so you may have two instructions executing simultaneously if you have two cores. 

    If you want to increase a processes performance, set its priority higher. Danny Stieben wrote an excelent artticle on process prioritization recently, you may read it here.

    Otherwise, Processor affinity is primarily beneficial for processes that don't perform multithreading. Most modern software can manage load balance much more effectively. 

    - Jeff