setting affinity on smp systems (in my case: for rose online)


On windows, you can set the processor affinity for hardwaredrivers and application programs.
I don’t usally have to set driver affinity any more, last time I did that was on an old quad ppro.

Reasons to not use irq affinity any more:
if your caches aren’t separate, the driver code will be in the cache of the active cpu (core) anyway.
so if you got a dualcore cpu with one shared cache, it doesn’t really matter. it mattered back when you had 4 (or even 6 on my ALR Revolutiion 6×6) different caches in the system and a wandering driver process (irq handler) would not benefit from caching everytime it ran on a new cpu, and also the cpus back then were so much slower that it was really helpful to dedicate whole cpus to single tasks.
still, for reference, the tool of choice was called irqfilter and it is quite easy to use so I won’t go into detail here…

process affinity is a different beast because:

  • windows has a quite bad scheduler and will lose some performance by not keeping a process (or thread) locked onto a single core
  • some software has bad internal loop timers and will run unreliably if it hops from cpu to cpu. with the game “rose online” I experience most ugly results due to this. sometimes it’ll be in slow motion, sometimes it’ll be too fast to play. unreal tournament was even worse 🙂
  • you want to restrict software that uses up insane amounts of cpu to only subset of your full cpu power, i.e. 1 core and its associated hyperthread on a Core i7 cpu.

step by step:
download the w2k server resource kit
identify imagecfg.exe and copy it to %systemroot% so it’s in your path
launch a cmd box

cd <application directory>
copy <application.exe> <application.sav>
imagecfg -a  mask application.exe 

the (binary) mask looks like this:
0x1 for cpu core one
0x2 for cpu core two
and it’d (what no other text covers) I think it would look
0x21 for the cores one and two


P:\Program Files\AruaROSE>imagecfg -a 0x2 roseonline.exe
roseonline.exe contains the following configuration information:
 Subsystem Version of 4.0
 Stack Reserve Size: 0x100000
 Stack Commit Size: 0x1000

Now I just need a system with two core i7 CPUs so I can test how to address things like the hyperthread of the third core of the second cpu.

hope this helps some people!

Last, there seems to be a tool  “setaffinity” by a company called Rimmelsoft, but their website wasn’t working when I last checked.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s