Setting CPU Affinity Prior Launch of App

AtotehZ

Distinguished
Nov 23, 2008
403
13
18,815
Hello guys,

I have had some problems with an application that doesn't like having all cores running at once. It became annoying to change the affinity every time I started the program so I found this in an old thread:

30 April 2010 Hand-E-Food wrote:

C:\Windows\System32\cmd.exe /C start "" /affinity XX "C:\Program Files\SpacialAudio\SAMBC\SAMBC.exe"

EDIT: XX = Hexadecimal number representing CPU affinity.

I've added the quotes for clarity. I'm not sure if it likes spaces in paths. I've added the first set of quotes because Start will annoyingly use the first set of quoted text as the title.

The affinity should be a single hexadecimal number, not a list of CPU numbers:
1 = use CPU 0
2 = use CPU 1
3 = use CPU 1 and 0
4 = use CPU 2
...
F = use CPU 3, 2, 1 and 0

This is great advise. I fixed my problem and it works great.

However, the reason I am writing here is because nowadays there are CPUs with 12 logical processors out there and figuring out what the correct hexadecimal number is is a chore, at least in my opinion.

Use binary to figure out what the hexadecimal number has to be. It makes it much more simple.

1 = Processor 1 (CPU-0)
10 = Processor 2 (CPU-1)
100 = Processor 3
100000000000 = Processor 12
110 = 2 and 3 only
101010101010 = 12, 10, 8, 6, 4, 2 only

The placement of a certain digit represents a certain processor. The value of that digit represents if the processor is to be on or off. Always read right to left.

Afterwards you can use this converter to get back to Hexadecimal:
http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html

I hope this will help other people if they encounter scenarios like mine.

WOW, the full edit function has been fixed during the make-over. Kudos to tomshardware!
 
Yeah, even though I work on systems where everything is coded in Assembly, and I occasionally have to make modifications to the BINARY code, I still need to use a pocket calculator to handle conversions to and from binary/hex/decimal.
 

gtjack9

Honorable
May 4, 2013
15
0
10,510


Do you know what the hexadecimal number would be for 8 processors I'm having trouble following this post
 

gtjack9

Honorable
May 4, 2013
15
0
10,510


Do you know what the hexadecimal number would be for 8 processors I'm having trouble following this post