MAXBG parameter

From m204wiki
Jump to navigation Jump to search

Maximum background/independent Daemons


Default value
Number of daemon (SDAEMDEV) threads divided by two, or number of daemon threads minus 10, whichever is greater
Parameter type
Where set
User 0 CCAIN parameters
Related products
Sirius Mods 7.0


This parameter specifies the maximum number of background or independent daemon requests that may be running at once. Before Sirius Mods 7.0, the only way to create a background daemon request was with the $CommBg function. Under Sirius Mods 7.0 and later, independent daemon requests can also be created using the Daemon class RunIndependently method. Daemons running either as a result of RunIndependently or $CommBg are both counted the same way against the MAXBG limit.

If a $CommBg request would exceed the MAXBG limit (or there are no daemon threads immediately available to run the request) the request is enqueued and run later when daemon threads are available and the number of running background/independent requests drops below MAXBG. If a RunIndependently request would exceed the MAXBG limit, the request is cancelled.

The default value of MAXBG is the number of daemon (SDAEMDEV) threads divided by two or the number of threads minus 10, whichever is greater. For example, if there are 10 daemon threads defined in the Online, MAXBG defaults to 5. If there are 40 daemon threads, MAXBG defaults to 30. While there was no explicit MAXBG parameter before Sirius Mods 7.0, the default MAXBG was used "under the covers" by $CommBg, anyway.

Setting MAXBG to a value greater than or equal to the number of daemon threads allows background/independent requests to use up every available daemon thread, if they want. Setting MAXBG to 0 indicates that the default value of MAXBG, calculated from the number of daemon threads, is to be used. This means that the lowest explicit value of MAXBG that will be honored is 1.