What is IB_AFFINITY for?
------------------------

IB_AFFINITY is a console mode program that you can use to control the affinity mask of the running IBServer.exe process. That means you can predict on which processor in your multiprocessor machine IBServer is allowed to run.

IB_AFFINITY does run on Windows NT only, not on Win-9x where multiple processors aren't supported anyway. The program was compiled with Delphi-4 (UP3) and tested on Windows NT-4 (SP5/6) with IB5.5 and IB5.6.


Command line switches:
----------------------

   -Q     Query current affinity mask
          Display the current affinity mask of IBServer.exe and the entire system
          before change.

   -An    New Affinity mask n (decimal) to set
          (n AND system_mask) is the new mask to apply.

   -N     Dont try to enable SeDebugPrivilege
          When you want to change the affinity mask of IBServer runnin as NT service,
          you need the debug privilege. The Administrator account has this privilege
          by default. IB_AFFINITY tries to enable this privilege unless you specify -N.
          If you don't have the debug privilege you can for example use -Q -N to query
          the masks without changing them or you can use -An -N to change the
          affinity mask of IBServer running as taskbar program.

   -Rn,m  Retry up to n times with m milliseconds delay to locate IBServer
          This option is useful in batches that start IBServer or IBGuardian and
          modify the affinity mask of IBServer immediately after. Under high load
          NT might not have finished to create the IBServer process when IB_AFFINITY
          starts. The retry option is useful to wait for the IBServer process to
          be instanciated. An value of -R10,10000 is recommended, but will of course
          delay the return of this tool by 100 seconds if IBServer is really not started.

   -Sprog Start the specified program. Unless combined with -N the program will be
          executed with the SeDebugPrivilege privilege enabled. Thus, the program will
          be able to perform API commands that require this privilege. When you start
          the NT Task Manager this way, you'll be able modify the affinity mask of
          IBServer.exe (running as service) or to terminate the IBServer service, using
          this gui program. So this is also useful for users who have a single cpu
          nt box.

Example 1:
----------
C:\> IB_AFFINITY -Q
Current affinity mask: System=15, IBServer=15

This means you have four system processors installed (15 dec = 1111 bin) and IBServer is
allowed to utilize all four processors.


Example 2:
----------
C:\> IB_AFFINITY -Q -A12
Current affinity mask: System=15, IBServer=15
Affinity mask set to 12
C:\> IB_AFFINITY -Q
Current affinity mask: System=15, IBServer=12

This changes the affinity mask of the IBServer process to 12 (= 1100 bin), so the process
is allowed to run on the system processors 3 and 4.


Example 3:
----------
C:\> IB_AFFINITY -Staskmgr.exe

This starts up the NT Task Manager with enabled SeDebugPrivilege, allowing the user
accessing processes that run as services.


Version History:
----------------
V1.2
- Support of new -Sprog switch
- Use FindWindow instead of EnumWindows to find running IBServer

V1.1
- Support of new -Rn,m switch
- Enhanced exception handling and error message output

V1.0
- Initial release


Disclaimer:
-----------
IB_AFFINITY is freeware. The sourcecode is available. It comes to you AS-IS.
Use it or do not use it, but if you use is, you do it on your own risk.


Author: Karsten Strobel
email : strobel@ait-augsburg.de
Date  : 15-MAR-2000
