Disabling a core through Set Affinity. What is it exactly?

Saro13

Reputable
Nov 5, 2015
20
0
4,510
So I am playing a game and I am trying to get better performance from it. One particular post online recommends disabling one of your cores through the games exe in the process tree if it is at 100% usage. Looking at the Performance in task manager does show one at roughly 100% and the others hanging around at roughly the 30-40% marker.

2vnqezl.png


Now before I do anything like this I just prefer to get some professional advice on it. What exactly will happen with the CPU? Will the work that core is getting just spread to the other 3? Never heard of "Set Affinity" in the Process tree. What is the normal usage for this?

And lastly just so I know for sure which is which. When I click Set Affinity it shows the processor cores as, CPU 0, CPU 1, CPU 2, CPU 3. Now going off of that Screen Shot I provided, is the core that is at 100% usage CPU 1? Assuming it starts at CPU 0 and the last being the CPU 3.


I5 4670k, Asus Z87-A, GTX 970, 16GB DDR, if more specifics needed please let me know
 
Solution
Set affinity just tells Windows that the process is/isn't allowed to run on certain cores.

Preventing the game from running on a core just ends up redistributing the threads to other cores. In this particular case though, since one core is at 100% while the others are at about 30%, that one core is probably running a poorly optimized thread. One that requires the most processing power, but hasn't been multi-threaded. So all you'll end up doing is cause a different core to peg at 100%. You can try it if you like though - setting affinity won't hurt the hardware or software.

As for the advice you read, you're misinterpreting it. It means if the game is pegging the entire CPU at 100% (i.e. all four of your cores are at 100%)...

Saro13

Reputable
Nov 5, 2015
20
0
4,510
Updated post at the bottom with specs, let me know if anymore information is needed

Also if it helps, considering I am only doing it for one specific game/process for it. Kingdom Come Deliverance is it.
 
No, disabling cores will not improve performance, and will almost certainly reduce performance.

What Core Affinity basically does is it tells the application "Do not assign threads to Core X". Now, there are the occasional cases where this can help, specifically disabling Hyperthreaded cores. That being said, 99.9% of the time the default Windows thread scheduling handles this case.

"Looking at the Performance in task manager does show one at roughly 100% and the others hanging around at roughly the 30-40% marker."

This is normal.

Most games do not scale evenly across multiple processing cores. What typically happens is two or three threads end up doing 80-90% of the total game processing, with another dozen or so accounting for 99% of the remaining workload. So when Windows schedules the threads, one core typically ends up doing a disproportionate amount of the work, as that is the core that ends up getting the highest workload thread.

Disabling a core in this case does nothing to change this situation; you'll still have 1 core hovering around 100%, but the other cores will end up doing more work as there's one less core available to handle processing. Even if there isn't an effect on FPS, disabling a core in this case could lead to an increase in latency (typically observed via "hitching" or frame drops) as your program gets interrupted by Windows background tasks.

Basically: Leave affinity alone. Changing the settings won't help performance.
 
Set affinity just tells Windows that the process is/isn't allowed to run on certain cores.

Preventing the game from running on a core just ends up redistributing the threads to other cores. In this particular case though, since one core is at 100% while the others are at about 30%, that one core is probably running a poorly optimized thread. One that requires the most processing power, but hasn't been multi-threaded. So all you'll end up doing is cause a different core to peg at 100%. You can try it if you like though - setting affinity won't hurt the hardware or software.

As for the advice you read, you're misinterpreting it. It means if the game is pegging the entire CPU at 100% (i.e. all four of your cores are at 100%), you can improve performance by preventing it from using one core. When a game monopolizes a CPU this way, it starves other processes on the computer of CPU time. If one of those other processes is vital to the game (e.g. reading data off the drive, or handling network traffic), then performance can improve if a core is suddenly freed up solely to handle these other tasks. Games which peg the entire CPU at 100% are usually poorly optimized (e.g. calculating way more FPS than it can display), so reducing the number of cores available to it usually won't hurt its performance.
 
Solution
So yeah, that was going to be my point as well. There is no reason to ever disable a core in order to GAIN performance. If a core is being utilized 100% and other cores are not, it is likely due to the fact that the developers for that game did not optimize it for multiple cores. Disabling that core will likely just cause it to use another core, but won't actually change anything other than the rest of the system might not have access to resources that are needed OR it might even totally boof that processes ability to run at all.

You want more cores, not fewer, in almost any situation. I would consider that advice as meaning exactly as has been stated above and would avoid doing this. No reason, and likely as Solandri has said, you have misinterpreted the reasoning or cause.