Lewey Geselowitz's World

Ink AniEd | Low Ink Pictionary | Magic Ink | Lazy Ink | More...
Shuzzle | Quake 2 AbSIRD | Evil Dice | Freed Go | Freed Series | SPonglet | More...
Evil Dice PE | Pocket AniEd | PDAbSIRD | Full Pegs | MindSweeper | More...
Quake 2 AbSIRD | AbSIRDlet | SPonglet | PDAbSIRD | AbSIRD Pixel Shader | More...
VSaber | Ink AniEd | Imp View | PDAbSIRD | Pocket AniEd | More...
subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link | subglobal7 link
subglobal8 link | subglobal8 link | subglobal8 link | subglobal8 link | subglobal8 link | subglobal8 link | subglobal8 link
 

Affinity - Tool To Use Only One CPU

Affinity is a small tool which can launch an application and restrict it to one CPU. Some older applications and games (such as the amazing System Shock 2) don’t work properly on multi-processor systems, but if you restrict them to one CPU then they work fine. Some tools exist out there to set the affinity of an application while it is running (Windows Task Manager can do this), however this is a hassle, rather just drop the application that you want to execute onto Affinity and it’s done in a completely non-invasive way. The term “affinity” is the set of CPUs on which Windows lets an application run.

Affinity.exe

Platform: Windows
Usage: Drop an executable on Affinity to launch it on only one CPU

SystemShock2.bat

Platform: Windows
Usage: Put this and Affinity.exe into your System Shock 2 folder, then run SystemShock2.bat. This will solve the multi-CPU / hyperthreading problem in a non-invasive way.
Note: This file merely contains 'Affinity SHOCK2.EXE'

How It Works
This a very simple app, the idea is that processor affinity is inherited by child processes; so Affinity sets it’s own affinity to only the first CPU, and then executes it’s argument, that simple. Here are the two core pieces of code (Win32 API for C); the first sets Affinity to run on only the first CPU, and the second executes the first argument to the app.

SetProcessAffinityMask( GetCurrentProcess(), 1 );
ShellExecute( NULL, NULL, argv[1], NULL, NULL, SW_SHOWNORMAL );

Running System Shock 2
I use Affinity to run System Shock 2 which makes it stable on multi-CPU or hyper-threaded systems. This means I can run the game using a simple script instead of starting it, switching to the Task Manager, setting the affinity and then switching back. Just download Affinity and the script below, put them in your System Shock 2 folder (probably C:/Sshock2/) and then execute the script to start playing. Optionally you can make a shortcut to the script file and use that (which is what I do).

E-mail | ©2004 Lewey Geselowitz
Page counter provided by