So when you have CPU with Simultaneous Multi Threading (SMT) like Intel’s Hyperthreading, the workload isn’t necessarily distributed to actual physical cores of the CPU.
When the CPU is working through the instructions it receives from the software it is running, those instructions rarely use ALL of the cores resources.
For example, a core might have 4 Arithmetic Processing Units, but an instruction only needs 2. So you have 2 spare APUs going unused on that core.
If you have another instruction in the queue that also only needs 2 APUs, you could execute both of those instructions on the same core at the same time and get more performance out of your CPU.
That’s what SMT implementations do. They organise instructions so that multiple threads can be executed on the same physical core simultaneously by fitting them into the cores resources.
And that’s where virtual cores come from, 2 virtual cores per physical core means the CPU will always be trying to share its resources so it has two threads executing where ever possible.
But because you want always get instructions that can fit together, especially from two specific threads, using virtual cores will never perform as consistently well as using separate physical cores.
Now what affinity is is specifying that you want some software to execute on that core as much as possible.
And basically no one thinks to write their application with a process affinity of anything other than the first group.
So you get a lot of things (including the OS) competing for those group resources while the rest of the CPU goes unused.
So when you set affinity to something other than the first group, that process will all but get a physical core to itself.
Latest Answers