Use process affinity to lock application to a single core

Microsoft Windows NT has supported multiple CPU's from the beginning, and the process scheduler can switch the execution of applications from one CPU to another incase a CPU becomes overloaded. But many older applications are optimized for a single core operation and actually performs slower (or crashes) if Microsoft Windows is allowed to switch the application between CPU's.

The actual performance benefit from locking an old application to a single core is very minimal, so this advice is mostly for the old applications that actually crashes when run on a multi core computer. It can also be a possible solution if the timing in a game is a bit off, or there are sound delays.
Set process affinity using the Task Manager
By launching the Task Manager (CTRL+SHIFT+ESC) then one can right-click any running process and choose "Set Affinity...". The change will last until the process stops, and will not be remembered the next time the process starts.

It is an easy way to check if an issue can be solved using process affinity. But some games might not handle the switch from fullscreen to Task Manager and back again without crashing.
Set process affinity using 3rd party application.
Set process affinity by modifying the executable
imagecfg.exe is part of the Microsoft support tools and resource kits and can modify an application to use the wanted process affinity.

imagecfg -a 0x1 c:\folder\myapp.exe

Set process affinity programmatically
Locking the MSDOS subsystem to a single CPU
Like all other processes the MSDOS subsystem can also be moved between CPU's. But where some applications can perform worse when between switched between CPU's, then it can actually cause the MSDOS subsystem to crash or lock entirely.

If going down the road of modifying the executable, then one will see that on Windows 2000/XP that ntvdm.exe is protected by Windows File Protection. The solution is to move the ntvdm.exe to another folder and modify this, and the change the registry to use the modified version:

[HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Control \WOW]
CmdLine = "..."
WowCmdLine = "..."

Credits Ask the Performance Team

Updated: 29 August 2010


  1. mkvreak says:

    Usually I did not experience any problems with applications running on different CPUs. The Windows 7 scheduler does its work fine.

    But there's still a usage for process affinity. Many games are programmed (by idiots?) so that they are running in a loop which consumes every CPU power it gets. Not only real-time strategy but also simple turn-based games. The upcoming of many-core processors is a relief because then a game does not use 100% but only 50% or 25% on a quad core. The Windows scheduler just spread the CPU demand on all cores. :)

    Now that many-cores are widely used, game programmers try to use also multiple cores. And they implement the software like the idiots before. Not only that a game uses 100% of ONE core, it now uses 100% of ALL cores. Big mistake. At least we can set the process affinity to only abuse one core to the max. Hopefully the CPU can internally manage to not let it overheat. ;)

Leave a Reply

Your email address will not be published. Required fields are marked *