Allow setting processor affinity.
[nssm.git] / README.txt
index 7ed473e..685807a 100644 (file)
@@ -53,7 +53,8 @@ Since version 2.19, NSSM can add to the service's environment by setting
 AppEnvironmentExtra in place of or in addition to the srvany-compatible\r
 AppEnvironment.\r
 \r
-Since version 2.22, NSSM can set the managed application's process priority.\r
+Since version 2.22, NSSM can set the managed application's process priority\r
+and CPU affinity.\r
 \r
 Since version 2.22, NSSM can rotate existing output files when redirecting I/O.\r
 \r
@@ -171,6 +172,25 @@ SetPriorityClass().  If AppPriority() is missing or invalid the
 application will be launched with normal priority.\r
 \r
 \r
+Processor affinity\r
+------------------\r
+NSSM can set the CPU affinity of the managed application.  NSSM will look in\r
+the registry under HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters\r
+for the REG_SZ entry AppAffinity.   It should specify a comma-separated listed\r
+of zero-indexed processor IDs.  A range of processors may optionally be\r
+specified with a dash.  No other characters are allowed in the string.\r
+\r
+For example, to specify the first; second; third and fifth CPUs, an appropriate\r
+AppAffinity would be 0-2,4.\r
+\r
+If AppAffinity is missing or invalid, NSSM will not attempt to restrict the\r
+application to specific CPUs.\r
+\r
+Note that the 64-bit version of NSSM can configure a maximum of 64 CPUs in this\r
+way and that the 32-bit version can configure a maxium of 32 CPUs even when\r
+running on 64-bit Windows.\r
+\r
+\r
 Stopping the service\r
 --------------------\r
 When stopping a service NSSM will attempt several different methods of killing\r
@@ -511,6 +531,10 @@ To configure the server to log to a file:
 \r
     nssm set UT2004 AppStdout c:\games\ut2004\service.log\r
 \r
+To restrict the server to a single CPU:\r
+\r
+    nssm set UT2004 AppAffinity 0\r
+\r
 To remove the server:\r
 \r
     nssm remove UT2004 confirm\r
@@ -542,7 +566,8 @@ Thanks to Joel Reingold for spotting a command line truncation bug.
 Thanks to Arve Knudsen for spotting that child processes of the monitored\r
 application could be left running on service shutdown, and that a missing\r
 registry value for AppDirectory confused NSSM.\r
-Thanks to Peter Wagemans and Laszlo Keresztfalvi for suggesting throttling restarts.\r
+Thanks to Peter Wagemans and Laszlo Keresztfalvi for suggesting throttling\r
+restarts.\r
 Thanks to Eugene Lifshitz for finding an edge case in CreateProcess() and for\r
 advising how to build messages.mc correctly in paths containing spaces.\r
 Thanks to Rob Sharp for pointing out that NSSM did not respect the\r
@@ -554,12 +579,15 @@ the default language when the user's display language was not translated.
 Thanks to Riccardo Gusmeroli for Italian translation.\r
 Thanks to Eric Cheldelin for the inspiration to generate a Control-C event\r
 on shutdown.\r
-Thanks to Brian Baxter for suggesting how to escape quotes from the command prompt.\r
+Thanks to Brian Baxter for suggesting how to escape quotes from the command\r
+prompt.\r
 Thanks to Russ Holmann for suggesting that the shutdown timeout be configurable.\r
 Thanks to Paul Spause for spotting a bug with default registry entries.\r
 Thanks to BUGHUNTER for spotting more GUI bugs.\r
 Thanks to Doug Watson for suggesting file rotation.\r
 Thanks to Арслан Сайдуганов for suggesting setting process priority.\r
+Thanks to Robert Middleton for suggestion and draft implementation of process\r
+affinity support.\r
 \r
 Licence\r
 -------\r