Subscribe to How-To Geek

Start an Application Assigned to a Specific CPU in Windows Vista

Windows Vista has an option that lets you start an application and set the CPU affinity, which assigns the application to run on a specific CPU in a dual-core system.

To start an application you have to pass the affinity flag to the start utility in the command prompt. For instance, if you wanted to start notepad assigned to CPU, you could use the following command:

c:\windows\system32\cmd.exe /C start /affinity 1 notepad.exe

You can see in task manager that the process is only assigned to CPU 0

To start a process on CPU 0, use the following command switch:

/affinity 1

For CPU 1, use this switch:

/affinity 2

You can use a number up to the number of CPU cores or CPUs in your system. The affinity is essentially CPU core # + 1, so /affinity 5 would use CPU 4.

You can almost modify the shortcut for an item to make it run on the specific CPU, by just prepending the full "c:\windows\system32\cmd.exe /C start /affinity 1 " onto the shortcut target. The only drawback to this approach is that the command prompt window will briefly flash on the screen.

The Geek is the founder of How-To Geek and a geek enthusiast. When he's not coming up with great how-to articles, he's probably writing at his personal blog. This article was written on 02/8/07 and tagged with: Windows Vista, Vista Tips & Tweaks

Comments (5)

  1. John McCutchen

    /affinity 5 does not use CPU 4

    1 uses CPU0
    2 uses CPU1
    3 uses CPU0 and CPU1
    4 uses CPU2
    5 uses CPU2 and CPU0
    6 uses CPU2 and CPU1
    7 uses CPU2, CPU1, and CPU0
    8 uses CPU3
    9 uses CPU3 and CPU0

    Convert the number to hex and reverse it to see which CPUs are to be used.

    I'm really appreciative of what you have shared with me as I have some applications that I've needed to be able to control the affinity of a process that I spawn.

    Thanks for your help.

  2. Dean

    Thanks to for this website. I've been work'n /w Vista going on two months and as your all aware. You have to unlearn what you've learned. Those older versions of window ie,. xp, xpro etc. have NOTHING on Vista. NO more just editing INI's is a thing of the past. But Wait There IS MORE! Hope anyone\everyone who aquires a version of vista like to read for this is NOT for the LAZY…..

    Thanks

  3. Jason Grant

    Is there anyway to force this with XP without having to reset the CPU affinity each time you launch the app?

  4. Dan

    Jason, try http://robpol86.com/pages/imagecfg.php

    Originally this comes from the Win2K resource toolkit, so probably safer to get it from there.

  5. Michael Vetter

    It seems that start /affinity works just for some applications. For example by starting firefox with start /affinity 01 firefox.exe the affinity was not set correctly. Could anybody else prove this or have a workaround?


Leave a Comment




Leave your friendly comment here. If you have a computer help question, leave it on the forums instead.

Note: Your comment may not show up immediately on the site.

Sponsored Links
Getting Started
About How-To Geek
Popular Articles

Copyright © 2006-2008 HowToGeek.com. All Rights Reserved.