Windows 8 and 8.1 Forums


Processor Affinity - Set for Applications in Windows 8

  1. #1
    Processor Affinity - Set for Applications in Windows 8

    Processor Affinity - Set for Applications in Windows 8
    How to Set Processor Affinity for an Application in Windows 8 and 8.1
    Published by Brink is online now
    21 Apr 2013
    Default Processor Affinity - Set for Applications in Windows 8

    Published by


    Brink's Avatar
    Administrator

    Join Date: Jul 2009
    Posts: 22,582

    How to Set Processor Affinity for an Application in Windows 8 and 8.1


    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, Windows 8 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 of 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.








    Processor Affinity - Set for Applications in Windows 8 OPTION ONE Processor Affinity - Set for Applications in Windows 8
    To Set CPU Affinity of Process in Task Manager

    1. Open the application (ex: CCleaner) that you want to change the processor affinity of.

    2. Open Task Manager with more details.

    3. If prompted by UAC, click/tap on Yes.

    4. In the Processes tab, right click on the application (ex: CCleaner64.exe) or process from step 1, and click/tap on Go to details. (see screenshot below)

    Click image for larger version

    5. In the Details tab, right click on the already highlighted name of the file (ex: CCleaner64.exe) for the process from step 4, and click/tap 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.

    Click image for larger version

    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/tap 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:  W8_Processor_Affinity-3.jpg
Views: 66483
Size:  27.5 KB

    7. Repeat for any other applications that you wish to change the processor affinity of.

    8. When finished, close Task Manager.







    Processor Affinity - Set for Applications in Windows 8 OPTION TWO Processor Affinity - Set for Applications in Windows 8
    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/tap on the Details tab, right click or press and hold on any process in the Name column, and click/tap 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.

    Click image for larger version

    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: 62484
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.
    For example, with my 000000000001 binary number, I get a hex value of 1. (see screenshot below)

    Name:  Binary-Decimal-Hexadecimal-Converter.png
Views: 62498
Size:  21.7 KB


    2. Open a command prompt.

    3. In the command prompt, type the command below into the location area, and click/tap 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,
    Shawn


  2. #1


    Posts : 1
    windows 8.1


    thank you for this tutorial, it was a great help to me, today!!!

      My System SpecsSystem Spec

  3. #2


    Posts : 22,582
    64-bit Windows 10


    You're most welcome Elytherial. I'm glad it was able to help.
      My System SpecsSystem Spec

Processor Affinity - Set for Applications in Windows 8
Related Threads
How to Create a Shortcut to Run an Application with a Set CPU Affinity in Windows 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...
For the past several days now I've been trying to get my computer to work with a fresh install of Windows 8.1. I've clean installed several times but if I try to boot the computer with more than 1 of my i5's cores enabled in the BIOS, the computer will completely freeze usually shortly after login....
Solved Save affinity for programs in Performance & Maintenance
Hi. Now every time launching an old program (i.e. The Simpsons Hit & Run) it loads veeeery slow and I have to always manually set the affinity to two CPU's instead of four and then program runs faster, especially the load time, it loads waaay quicker. So how do I set the affinity and it always...
Hey guys. I can't find a concrete answer anywhere to this question and this forum seems to be the most knowledgeable/helpful. Right now I have an asus h61-le-CSM motherboard with EFI; it's a little older with a i3 2120 processor. On Friday I'm upgrading to a Gigabyte GA-Z77X-UD5H with a i7...
Windows Command Processor in General Support
I download the and burned the iso image when the consumer preview became available. I was getting an error from the action center that said wcpotherfailure3. This morning I decided to download and burn the iso again to see if it was something with the previous image. After the...
Solved CPU Affinity/Priority in General Support
Is there a way to set CPU affinity or priority to an app in the dev preview at all? I checked task manager, but the feature seems to no longer be in there as it is in previous versions of Windows.
Eight Forums Android App Eight Forums IOS App Follow us on Facebook