HOW TO: Process/File Affinity, Imagecfg Control
- YARDofSTUF
- Posts: 70006
- Joined: Sat Nov 11, 2000 12:00 am
- Location: USA
HOW TO: Process/File Affinity, Imagecfg Control
With HyperThreading and Dual Core CPUs being common in all kinds of systems there may be alot of people interested in controlling which processes use which CPU. This would work for Dual CPU systems to.
The program to use for this is Imagecfg.exe. You can google it to find a download, or get it off of a Windows 2000 or Windows XP Server Resource Kit.
Imagecfg.exe will work with Windows XP(32 bit and 64 bit), Windows 2000, Windows 2003, and hopefully Windows Vista. It is a permanent change to the file, so make a backup before testing.
Imagecfg.exe has a bunch of uses, use the "/?" switch to see all of your choices.
To set a process's affinity use "imagecfg -a 0xn [File Path] [File Name]
Replace n with the CPU you want the process to use.
1 = CPU0
2 = CPU1
4 = CPU2
8 = CPU3
So if you wanted to set C:\Test\Dummy.exe to use the second CPU(CPU1) ir would look like this:
imagecfg -a 0x2 C:\Test\Dummy.exe
For dual core or dual CPU users both CPUs will perform equally, but with HyperThreading enabled systems the first CPU (CPU0) is faster, because the 2nd CPU is just a virtual CPU recycling unused cycles from the first CPU.
By moving processes around it can allow you maximize the performance of CPU intensive programs and games by assigning all necessary processes to 1 CPU, freeing the other CPU for the intensive application.
I've just started messing around with this so I don't have any benchmarks or proof that this does anything, theoretically it should help, most likely in a very small ammount though.
Flaws:
Imagecfg does not seem to recognize folders with spaces in it like "C:\Program Files". To get by this copy the Imagecfg.exe file to that directory and exclude the directory /path.
I'll update this with more information as I get it. Mark and Scott on here, Robpol86.com, and PlanetAMD64 Helped me get all this info.
The program to use for this is Imagecfg.exe. You can google it to find a download, or get it off of a Windows 2000 or Windows XP Server Resource Kit.
Imagecfg.exe will work with Windows XP(32 bit and 64 bit), Windows 2000, Windows 2003, and hopefully Windows Vista. It is a permanent change to the file, so make a backup before testing.
Imagecfg.exe has a bunch of uses, use the "/?" switch to see all of your choices.
To set a process's affinity use "imagecfg -a 0xn [File Path] [File Name]
Replace n with the CPU you want the process to use.
1 = CPU0
2 = CPU1
4 = CPU2
8 = CPU3
So if you wanted to set C:\Test\Dummy.exe to use the second CPU(CPU1) ir would look like this:
imagecfg -a 0x2 C:\Test\Dummy.exe
For dual core or dual CPU users both CPUs will perform equally, but with HyperThreading enabled systems the first CPU (CPU0) is faster, because the 2nd CPU is just a virtual CPU recycling unused cycles from the first CPU.
By moving processes around it can allow you maximize the performance of CPU intensive programs and games by assigning all necessary processes to 1 CPU, freeing the other CPU for the intensive application.
I've just started messing around with this so I don't have any benchmarks or proof that this does anything, theoretically it should help, most likely in a very small ammount though.
Flaws:
Imagecfg does not seem to recognize folders with spaces in it like "C:\Program Files". To get by this copy the Imagecfg.exe file to that directory and exclude the directory /path.
I'll update this with more information as I get it. Mark and Scott on here, Robpol86.com, and PlanetAMD64 Helped me get all this info.
- YARDofSTUF
- Posts: 70006
- Joined: Sat Nov 11, 2000 12:00 am
- Location: USA
- YARDofSTUF
- Posts: 70006
- Joined: Sat Nov 11, 2000 12:00 am
- Location: USA
- YARDofSTUF
- Posts: 70006
- Joined: Sat Nov 11, 2000 12:00 am
- Location: USA
- YARDofSTUF
- Posts: 70006
- Joined: Sat Nov 11, 2000 12:00 am
- Location: USA
- YARDofSTUF
- Posts: 70006
- Joined: Sat Nov 11, 2000 12:00 am
- Location: USA
ah i see, i set the imagecfg to the console.exe, did you set yours to the individual cores ?
i wonder if i did this right
i followed the instructions here and used "imagecfg -a 0x1 c:\path\to\file.exe", where file.exe is the console.exe
i wonder if i did this right

i followed the instructions here and used "imagecfg -a 0x1 c:\path\to\file.exe", where file.exe is the console.exe
- YARDofSTUF
- Posts: 70006
- Joined: Sat Nov 11, 2000 12:00 am
- Location: USA
I did it to each *.exe file.Mark wrote:ah i see, i set the imagecfg to the console.exe, did you set yours to the individual cores ?
i wonder if i did this right![]()
i followed the instructions here and used "imagecfg -a 0x1 c:\path\to\file.exe", where file.exe is the console.exe
- YARDofSTUF
- Posts: 70006
- Joined: Sat Nov 11, 2000 12:00 am
- Location: USA
The answer is to backup the exe first since this utility literally modifies the exe you point it to use. It's only useful if you literally want the app to stay running on one and only one core.graysky wrote:Great guide, thanks. How can I undo the settings I added? In other words I want to enable the app on all the cores (I have a q6600)?
Enclose the path with "" and spaces are no problem.Flaws:
Imagecfg does not seem to recognize folders with spaces in it like "C:\Program Files". To get by this copy the Imagecfg.exe file to that directory and exclude the directory /path.
Sorry for the bump but I found this guide still very helpfull running Simcity 4 on my core 2 duo, maybe others might too.
- YARDofSTUF
- Posts: 70006
- Joined: Sat Nov 11, 2000 12:00 am
- Location: USA
- YARDofSTUF
- Posts: 70006
- Joined: Sat Nov 11, 2000 12:00 am
- Location: USA