/Affinity Command line Question

So I was told to use /affinity to spread out servers on multiple cores. My question is what numbers do I use for each cores? I read some person did 2 for 1st core, then 4 for 2nd core, and it was really confusing. If I am using a 3 core VPS on NFO servers would I just use /affinity 1 for the first core then another server /affinity 2? Thanks! (Special thanks to #1 Husky for answering my previous question and sorry for not fully understanding!)

I’m gonna guess (Probably wrong idk?) that the arg for /affinity is in bits, so it’s 2^n, n being amount of cores.

2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16


Thank you for replying! So may I ask what the final numbers you’ve calculated stand for? So if mine is
2^3 = 8 what does the 8 mean and what numbers would I input into /affinity? Sorry I have 0 experience with this and am struggling to fully understand. Thank you for spending time to explain!

according to this page http://www.techrepublic.com/blog/windows-and-office/change-the-processor-affinity-setting-in-windows-7-to-gain-a-performance-edge/

for a quad core processor:

cpu 0 = /affinity 1
cpu 1 = /affinity 2
cpu 2 = /affinity 4
cpu 3 = /affinity 8

cpu 0+1 = /affinity 3

No worries, but refer to me as James :v: . As the user above has said, affinity works using powers. Imagine you have 8 cores, and you represent them as a series of 8 0s: 00000000. CPU 0 is the rightmost 0, CPU 1 is the second rightmost 0, and so on. Now imagine changing the CPUs you want to use to 1. If you want to use CPU 0, it would look like 00000001, if you want to use CPU 5, it would look like 00100000. If you want to use CPU 0 and 5, it would look like this: 00100001. Notice how this looks like binary? It’s because it is. Here’s an explanation of binary if you don’t understand really:

00000001 = 1
00000010 = 2
00000100 = 4
00001000 = 8
00010000 = 16
00100000 = 32
01000000 = 64
10000000 = 128

So to use the example above, if you wanted to use CPU 0 and 5 (00100001), the number you would insert is 33 because:

00000001 (1)  +
00100000 (32) =
00100001 (33)

The reason it works like this is because it’s the simplest way to say which cores you want to use, by only entering 1 number. I hope this helps you without going too much into detail. For further read, you should look up how base 2 calculations work.

Thank you for detailing. Just to see if I understand this properly if I have a 3 core VPS it would be
00000001= 1
00000010= 2
00000100= 4
So if I wanted to use 2 cores even though it’s useless on gmod for say CPU 0+CPU2 the command would be /affinity 5? Or for say CPU 0 would be /affinity 1?

[editline]21st April 2015[/editline]

Or my bad. 001,010,100

Yup, It’s exactly like that. Glad I could help.

Thank you so much! Glad I finally understand! Thanks to everyone else with supportive comments!