Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Processor Affinity - Set for Applications

Processor Affinity - Set for Applications

How to Set Processor Affinity to an Application in Windows 7
Published by Brink
09 May 2010
Published by

How to Set Processor Affinity to an Application in Windows 7

information   Information
Processor affinity or CPU Pinning enables the binding and un-binding of a process or thread to a physical CPU or a range of CPUs, so that the process or thread in question will run only on the CPU or range of CPUs in question, rather than being able to run on any CPU

By default, Vista and Windows 7 runs an application on all available cores of the processor. If you have a multi-core processor, then this tutorial will show you how to set the processor affinity for an application to control which core(s) of the processor the application will run on.

If the application and CPU supports Symmetric Multiprocessing (SMP) or HyperThreading (HT), then Windows will automatically adjust the application's usage of each processor core for the best performance. You will not gain much, if anything, from manually changing the processor affinity for these type of applications.

If you have more then one processor intensive applications running, then you could improve their performance by setting the processor affinity of their processes to run on a different core(s). This way they are not competing for the resources of the same core(s).

Note   Note
It is NOT recommended to change the processor affinity for system processes. Doing so could reduce their performance or slow the system down.

The affinity changes you make to the current instance of an application or process are only temporary and not set permanently. Once you close the application or restart your system, the processor affinity of the application will automatically return back to the default of running on all available CPU cores.

To Set CPU Affinity of Process in Task Manager
1. Open the application that you want to change the processor affinity of, and do step 2 or 3 below.

2. If the Application Does Not "Run as administrator"
A) Right click on a empty space on the taskbar, click on Task Manager, and go to step 4 below.
NOTE: You can also press CTRL+SHIFT+ESC to open Task Manager.
3. If the Application Does "Run as administrator" (Elevated)
A) Click on the Processes tab in Task Manager, then click on the Show processes from all users button. (see screenshot below)
Name:  Step1.jpg
Views: 20627
Size:  95.3 KB
B) If prompted by UAC, then click on Yes (if administrator) or enter the administrator's password (if standard user).

C) Continue on to step 4.
4. In Task Manager, click on the Applications tab, right click on the application from step 1, and click on Go to Process. (see screenshot below)
[Name:  Step2.jpg
Views: 20500
Size:  55.3 KB
5. In the Processes tab, right click on the application's process, then click on Set Affinity. (see screenshot below)
NOTE: If Set Affinity is grayed out, then it means that the process cannot have the processor affinity set for.
6. Check (allow) or Uncheck (not allow) one or more CPU cores that you want to be allowed or not allowed to run the application on, then click on OK. (see screenshot below)
NOTE: Only the number of cores in your processor(s) will be available to set affinity to. CPU-0 = Core 1, CPU-1 = Core 2, etc...
Name:  Step4.jpg
Views: 20405
Size:  26.9 KB
7. Repeat for any other applications that you wish to change the processor affinity of.

8. When finished, close Task Manager.

To Run a Program with a Set CPU Affinity in Command Prompt
1. This step will show you how many CPU cores you have, and how to figure the hex value to use at step 3 below for the CPU(s) you want to run the application on.

NOTE: If you should need any assistance with this step, then please feel free to post. I'll be happy to help.

A) Open Task Manager (CTRL+Shift+ESC) in more details view, click on the Processes tab, right click on any process in the Image Name column, and click on Set affinity. (see screenshot below)

NOTE: This will show you how many CPU cores you have. I have 12 CPU cores numbered from 0 to 11.
B) For how many CPU cores you have will also be how long the binary number will be. Since I have 12 CPU cores, the binary number will be 12 zeros 000000000000. Each zero in the binary number represents a CPU core number from right to left. In my case with 12 CPU cores, the far right 0 in the binary number will be for CPU 0, and the far left 0 will be for CPU 11. (see screenshot below)

C) For each CPU number you want to run the application on, replace 0 (off) with 1 (on) in the binary number for the CPU numbers.

For example, if I wanted to run the application only on CPU 0, then my binary number would be changed to 000000000001. To run the application on CPU 0 and CPU 3, I would use 000000001001. (see screenshot below)
Name:  binary.jpg
Views: 18222
Size:  34.9 KB
D) Go the website below, and type your binary number from step 1C above into the Binary field. This will convert the binary number to a hexadecimal (hex) that you will need to use at step 3 below.
Website: Binary/Decimal/Hexadecimal Converter
For example, with my 000000000001 binary number, I get a hex value of 1. (see screenshot below)

Name:  Binary-Decimal-Hexadecimal-Converter.png
Views: 18016
Size:  21.7 KB
2. Open a command prompt.

3. In the command prompt, type the command below into the location area, and click on the Next button. (see screenshot below)

cmd.exe /c start "Program Name" /affinity # "Full path of application file"
For example: I would type this command below exactly if I wanted to create a shortcut to run Process Monitor on only CPU 0 (step 1), and it's .exe file is located at "E:\Programs\Process Monitor 3.05\Procmon.exe".

(For only on CPU 0)
cmd.exe /c start "Process Monitor" /affinity 1 "E:\Programs\Process Monitor 3.05\Procmon.exe"

(For on CPU 0 and CPU 3)
cmd.exe /c start "Process Monitor" /affinity 9 "E:\Programs\Process Monitor 3.05\Procmon.exe"

Note   Note
Substitute Program Name in the command with the actual program's name within quotes.

Substitute # in the command for the affinity # with the hex value (ex: 1) from step 1D above.

Substitute Full path of application file in the command with the full path of the file within quotes.

That's it,

13 Jul 2010   #1

Windows 7

I don't have an option in my processor drop down menu to change the affinity setting. A fix to an issue I am having from other forums is to change this but there is nothing under set priorty. Any ideas??

My System SpecsSystem Spec
13 Jul 2010   #2

64-bit Windows 10 Pro

Hello 601122, and welcome to Seven Forums.

Is the Set Priority menu empty for all of the listed proccesses, or just this one?

For now, you might see if running a sfc /scannow command may be able to help.
My System SpecsSystem Spec
13 Jul 2010   #3

Windows 7

As you can see there is no option under the set priority to change the Affinity setting. My knowledge is very basic.


Attached Thumbnails
My System SpecsSystem Spec

13 Jul 2010   #4

64-bit Windows 10 Pro


I know this may seem silly, but did you move the mouse pointer over Set Priority to expand the arrow menu?
My System SpecsSystem Spec
14 Jul 2010   #5

Windows 7

Hi thanks for assistance, yes it gives 6 options, real time, high, above normal, normal, below normal and low. Cheers.
My System SpecsSystem Spec
14 Jul 2010   #6

64-bit Windows 10 Pro

That's great news. You're most welcome.
My System SpecsSystem Spec
15 Jul 2010   #7
mickey megabyte

ultimate 64 sp1

you can 'permanently' set a program's affinity by creating a .bat batch file in the same folder as the program, with the contents:

start /affinity 1 program_name.exe
this will force the software to use only cpu core 0. use ... /affinity 2 ... to specify cpu core 1 etc

you should then modify the program's start-menu and/or desktop shortcut to point to your newly created batchfile.

a tiny drawback is that you will see a small cmd window briefly flash on the screen before your program opens.


for extra performance, you can add /high to give the application a higher cpu priority.

start /affinity 1 /high program_name.exe
(Brink, if you can rewrite this to make it clearer, then please do. )
My System SpecsSystem Spec

 Processor Affinity - Set for Applications

Tutorial Tools

Similar help and support threads
Windows 7 Tutorial Category
How to access "Processor Affinity" screen without Task Manager?
Hey. I'm trying to create a macro, through Auto HotKey, that will automatically set the processor affinity of some program. It's problematic because the only way I know of, is to right click the process in Task Manager. The process's location changes each time, so I can't direct the macro to...
General Discussion
Processor Affinity - Add Set Affinity to Context Menu
How to Add or Remove "Run with CPU Affinity" to the Context Menu By default, Vista, Windows 7, and Windows 8 runs an application on all available cores of the processor. If you have a multi-core processor, then this will show you how to add or remove Run with CPU Affinity from all...
Save process priority and affinity
Hello, I'm running a few gameservers myself on Windows Server 2008 R2 but I'm wondering if it's possible to make my system recognize that the process was ran earlier, and it'll apply the correct affinity and priority. The problem is that I used to use ProcessLasso, but after 40 days of uptime...
Performance & Maintenance
How to set affinity for Media Center?
How do I assign Windows Media Center to one core? I don't know all the process names. If someone knows what they are I think I could do it with task manager.
Media Center
Processor Intensive Applications Crash PC
Everytime I run a processor intensive application (Video Compression, Running Market Simulations, etc.) After five to ten minutes my machine crashes. If I run the same applications with shorter jobs it completes and the machine doesn't crash. This is a hard crash where everything just blanks...
BSOD Help and Support
Set affinity in task mgr as default
I run a screen magnifier/reader that I want to use both my cpu's but at the moment it is set to only use one.I can change it manually to two but it reverts back to one after reboot. I do that in task manager. How can I change it to both cpu's as default?
Performance & Maintenance

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 12:32.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App