The problems I
previous posted about SPSS syntax files crashing on our new Hyper-Threading Pentium 4 systems led me to write a program to launch a process and then set it to use specific processor:
runaffny.exe
Although I do like the
THG Task Assignment Manager program, unfortunately it has to be running
before the target application is launched. Showing one or two users how to use it properly is one thing, but rolling it out into a student computer lab, or in a hundred or more faculty offices, doesn't appeal to me. I also came across a console utility,
process.exe, which lets you list or set the affinity of an already
running program.
I definitely prefer console apps, to use in batch file scripts, but I wanted a utility where I could simply replace the SPSS shortcut with one that would launch the app just the same, but would also automatically set the program to use only one processor.
So, I copied over my new console app to %SystemRoot% and then created a shortcut as so:
%SystemRoot%\runaffny.exe "c:\program files\spss\spsswin.exe"
By default, this will set the affinity to use only CPU0. (I also changed the icon to use the one in the SPSSWIN.EXE itself, so now, to the user, they don't know there is anything different about running the program.)
Other than adding in command-line argument handling and such, the gist of the app is just calling
CreateProcess() and
SetProcessAffinityMask().
Of course, I would rather have SPSS simply make an option within the program itself, to set a default processor affinity each time the application is run. At the very least, since they know syntax files are crashing on SMP/Hyper-Threading PCs (and Macs), they should at the very least always set the syntax file execution thread to a single processor affinity. Quite honestly, I shouldn't have to had to spend any time writing a program to work around a bug in their software.