CPU Affinity: Improve your multitasking

Status
Not open for further replies.

blackpearl

The Devil
What is CPU Affinity?

Simply stated, CPU affinity is the tendency for a process to run on a given CPU as long as possible without being moved to some other processor. When we run an application on a dual-core processor, usually both the cores get used depending on whether the application is multi threaded or not and how efficiently Windows distributes the threads between the 2 cores.

Its possible to take the control on your hands by assigning different applications to different cores so that they run only on the assigned core. By doing this you can assign one application to one core and another application to the other core, so that you can multitask and none of the 2 application interfere with each other. This comes handy when you want to say, rip a DVD and play a game at the same time. By assigning both the DVD ripping program and the game to seperate cores you can play your game with ease without having to worry about game lagging or low FPS.

Changing CPU affinity is easy.

1. First launch the program you want to change CPU affinity of.
2. Open Task Manager and then click on the Process tab.
3. Locate the application from the list and right-click, and then click Set Affinity
4. Now uncheck the corresponding box of whichever CPU you don't want the program to run on.

This method can be a bit difficult to assign CPU affinity to games because you have to run the game for the process to appear on the task manager's list, and once the game loads, the task manager disappears. There is workaround to this problem. For this download a small utilty called imagecfg.exe (24KB only)

1. First copy this tool to the game folder.
2. Now make a backup of the executable file of the game. Just copy it to some safe location. This is important.
3. Open command prompt and go to your game folder and type

imagecfg -a 0x1 game.exe (suppose the game file is game.exe)

Done. This will patch the game file so that it will run always on Core1. To assign it to core 2 type:

imagecfg -a 0x2 game.exe

Here are some screenshots:

*i15.tinypic.com/2lixzph.jpg
A DivX encoder running without assigning CPU. Watch both cores in action.



*i7.tinypic.com/497rllx.jpg
The same encoder running after assigning it to Core1. See core2 lying idle.

Happy multitasking :)
 
Status
Not open for further replies.
Top Bottom