LOGO

Assign Application to CPU in Windows 7, 8, & Vista

February 8, 2007
Assign Application to CPU in Windows 7, 8, & Vista

CPU Affinity in Windows: Controlling Application Processor Assignment

Windows provides a feature enabling users to designate which CPU core an application utilizes. This CPU affinity setting allows for the assignment of an application to a specific processor within a multi-core system.

Setting CPU Affinity via Command Prompt

To launch an application with a defined CPU affinity, the start utility within the command prompt must be employed, utilizing the affinity flag. This allows precise control over processor allocation.

For example, to initiate Notepad and restrict its operation to CPU 0, the following command can be executed:

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

Verification of this assignment can be performed through the Task Manager, confirming the process is exclusively bound to CPU 0.

Affinity Switch Values

The command-line switch for initiating a process on CPU 0 is:

/affinity 1

Conversely, to launch a process on CPU 1, the following switch should be used:

/affinity 2

The affinity value corresponds to the CPU core number plus one. Therefore, a value of /affinity 5 would direct the application to utilize CPU 4.

Modifying Application Shortcuts

It is possible to alter application shortcuts to consistently launch with a specific CPU affinity. This is achieved by prepending the command c:\windows\system32\cmd.exe /C start /affinity 1 to the shortcut's target path.

However, a minor visual artifact exists with this method. A command prompt window will momentarily appear on the screen during application startup.

This technique offers a convenient way to persistently control processor assignment for frequently used applications.

#CPU affinity#Windows 7#Windows 8#Windows Vista#application performance#process priority