KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to change CPU priority programatically
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: February 3, 2006

4th Dimension allows you to optimize your application with the use of the "CPU Priorities" preference. This gives the user the capacity to modify the frequency with which 4th Dimension application must "switch back" to the OS. The setting can be modified in the preferences dialog within the "Application" theme. In addition, the developer can also make this change through code. The following command that helps fulfill this is SET DATABASE PARAMETER.

SET DATABASE PARAMETER ({table; }selector; value)

Selector = 10 (4th Dimension Scheduler)

Selector = 11 (4D Server Scheduler)

Selector = 12 (4D Client Scheduler)

• Values: For these three selectors, the value parameter is expressed in hexadecimal 0x00aabbcc detailed as follows:

aa = minimum number of ticks per call to the system (0 to 100 included).

bb = maximum number of ticks per call to the system (0 to 100 included).

cc = number of ticks between calls to the system (0 to 20 included).

If one of the values is out of range, 4D sets it to its maximum. You can pass one of the following preset standard values in the value parameter:

value = -1: maximum priority allocated to 4D,

value = -2: average priority allocated to 4D,

value = -3: minimum priority allocated to 4D.

• Description: This parameter allows you to dynamically set the 4D system internal calls. Depending on the selector, the scheduler value will be set for:

- 4th Dimension (single user) and 4D Tools, when the command is called from 4th Dimension (selector=10).

- 4D Server when the command is called from 4D Server (selector=11).

- 4D Client when the command is called from 4D Client (selector=12).

Note: The operation of selector 12 (4D Client Scheduler) differs according to whether the SET DATABASE PARAMETER command is executed on the server machine or on the client machine:

- If the command is executed on the server machine, the new value will be applied to all the client machines that connect to it subsequently.

- If the command is executed on the client machine, the new value is applied to the client machine immediately as well as to all the client machines that connect to the server subsequently.