"You can permanently set processor affinity for a non-operating system executable, on both Windows 2000 and Windows NT 4.0, by using the Imagecfg.exe tool from the supportdebugi386 folder of a Windows NT 4.0 CD-ROM, or the Imagecfg.exe tool from the Windows 2000 Server Resource Kit Supplement One.
NOTE: Do NOT use imagecfg on any kernel operating system files.
To permanently set the processor affinity for your 32-bit executable, open a CMD prompt and type:
imagecfg -a 0xn <Drive:>Pathyourprogram.exe
where 0xn is the affinity mask. The mask constrains your application to a specific CPU, from 0 - 31, where:
CPU MASK
0 0x1
1 0x2
2 0x4
3 0x8
4 0x10
5 0x20
6 0x40
7 0x80
8 0x100
etc
To set the affinity for "c:utilCountry Codes.exe" to processor 1, I typed:
imagecfg -a 0x2 "c:utilCountry Codes.exe"
and received the following response:
c:utilCountry Codes.exe contains no configuration information
c:utilCountry Codes.exe contains a Subsystem Version of 4.0
c:utilCountry Codes.exe updated with the following configuration information:
Process Affinity Mask: 00000002
When I launch Country Codes.exe, its' affinity is set to CPU 1."
Setting affinity permanently using Imagecfg.exe
- BingoTheClowno
- Posts: 1722
- Joined: Wed Nov 12, 2003 4:00 pm
- Location: Chicago
- Contact: