Permanent processor affinity
Serdar Yegulalp

"Processor affinity" is a term used when running applications on a system with more than one processor. A common way to distribute the load through a system with multiple processors is to associate a particular app with a particular processor. That way, apps that have typically high demands -- such as SQL Server -- stay with their own processor and don't steal processing power from other applications, which may also have their own affinities. This way you can insure that applications that are launched without direct user intervention can distribute themselves evenly across processors.

Some programs can do this internally -- associate themselves with a particular processor -- but such applications are few and far between. If you want to do this yourself with an app that doesn't normally support it, you'll need to use a tool from the Windows 2000 Server Resource Kit (Supplement #1). You can also find this tool in the SUPPORT folder of the Windows NT/2K Server CD-ROM.

The tool in question is named IMAGECFG.EXE -- Image Config, so named because Microsoft refers to application binaries in Windows as the "image" of an application. Don't use IMAGECFG on any binaries that come bundled with the OS, just third-party applications.

To set processor affinity for an app, you'll need to run IMAGECFG from the command line with the following parameters.

imagecfg -a 0xn

    Requires Free Membership to View


The "0xn" is a hex code that sets which processor to give the program affinity to. For processor 0, it's 0x1; for processor 1, it's 0x2. The numbers go up to 32 processors, but the progression of the mask is peculiar: 0x1, 0x2, 0x4, 0x8, then 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, and so on.

Once you do this, the binary for the program in question will be changed permanently, so it's a good idea to make a backup copy of the binary in question before playing with this. Also, you cannot use IMAGECFG on .DLLs.

Serdar Yegulalp is the editor of the Windows 2000 Power Users Newsletter.

This was first published in October 2001

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.