Switching the default CPU affinity a program runs with is not a breathtaking feature. You can easily achieve this from Windows Task Manager. But keeping the program under the same affinity even after restart is not among Windows’ capabilities. Fortunately, for those needing an application to be awarded with the attention of only specific CPU cores there is RunWithAffinity.
It is a freebie designed to confine any application on your system to function with limited CPU power. RunWithAffinity is portable so no installation is required to run it. Simply double click the executable and the interface will pop right up.
Looks are not impressive and there isn’t too much to configure as the app features a single window where you get to define the program you want to apply the CPU restriction to. Additional input from your part includes selecting the affinity and defining program parameters.
Although the application is designed for a simple job, once you load up the target program it’ll offer some details, either for accurate identification or for general knowledge. This includes the name of the executable, description string and size of the file. Also, you will have the icon loaded as well.
As expected, RunWithAffinity identifies the processor type available on the system and lets you choose the core affinity. The choices in our case were limited as we ran the tests on a dual core machine, but it will recognize the number of cores on more quad core systems with no problem.
However, we noticed that it uses different numbering of the cores than Task Manager. Microsoft starts the count from zero while RunWithAffinity starts from 1. This should not be a problem, though, but merely an aspect worth mentioning. We learned from our testing that the app supports up to 16 cores.
In order to make sure that the desired program preserves CPU affinity every time it runs and to make the entire process as seamless as possible, you can create a shortcut that does launches the targeted item with the specific affinity you assign. The result can be a desktop (default location, but you can change it) shortcut with the icon of the target program and a name of your choice.
But what exact are the benefits of assigning a different CPU affinity than the default one? Performance would be the answer. Each time a process terminates it will leave some remnants behind, in the processor’s cache. Thus, in the case of tasks that are launched frequently threads would already be loaded and a performance bump would be recorded. Thus, scheduling the task to use the same CPU core all the time it will run more efficiently because the threads don’t have to be moved to a different core.
The apps eligible to rip these benefits are regularly those that do not use multiple threads: certain graphic rendering applications, antivirus scans and even games. Although you won’t see a performance boost in most programs, running them on assigned cores should have a positive impact on overall system performance since they have an entire core at their disposal. Of course, for best results these applications have to be lightweight.
RunWithAffinity makes for an extremely comfortable way to assign the power of a specific core to a process, but there is also a manual, more difficult way to achieve this. The same effect can be obtained by using “start” command line in the “Target” field of a shortcut: C:\WINDOWS\system32\cmd.exe /c start “your program.exe” /affinity (affinity number) “(path to exe file)”.
For instance, in the case of Google Chrome, the result would be: C:\WINDOWS\system32\cmd.exe /c start “chrome.exe” /affinity 1 “C:\Program Files\Google\Chrome\Application\chrome.exe”. Punching this in the “Target” line would permanently set Chrome’s CPU affinity to the second core of our test machine.
As simple as RunWithAffinity is, we did bump into an unexpected error, though. It looks like the app is designed to create valid shortcuts only if one of the available CPU cores is selected. If you choose to run the target program on all cores, the RunWithAffinity shortcut will not work.
It allows you to create a shortcut in an extremely easy fashion, by simply adding the program you want to run with specific CPU affinity and selecting the desired core. If you do not want a shortcut created you can just load a program, assign it a CPU core and launch it straight from RunWithAffinity.
The Good
The Bad
The Truth