This section describes how memory is shared among processes.
The UNIX system controls all the physical memory in the system, but shares memory with other processes (at UNIX's expense). D3 requires that a certain amount of this memory be allocated to D3 (shared) from the total system memory available.
The D3 configuration file, /usr/lib/pick/pick0, contains two statements that determine how much shared memory D3 allocates. The core statement specifies how much shared memory D3 requires for the operation of D3, and the BASIC statement specifies how much additional memory is required for the efficient operation of FlashBASIC programs.
The D3 installation process inserts default values for the core and BASIC statements into the D3 configuration file, which tries to accommodate the needs of most sites. However, the system performance can be improved by adjusting the shared memory requirements to more accurately reflect the system conditions.
As of D3 Linux 9.0 for Redhat Enterprise Linux 6, the installation procedure modifies the SHMMAX kernel parameter. In previous releases, this was done dynamically upon D3 startup. However, this is no longer permitted by Linux. As such, modifying this parameter manually may have an adverse affect on the ability of D3 to efficiently allocate memory.
This section shows how to calculate accurate values for the core and BASIC statement values.
As of D3 7.1.0, when abslock is on, which means loading all the ABS into memory and keeping them there, the virtual ABS are now loaded into a read-only shared memory segment. To disable this feature for the entire virtual machine, use the absprotect off statement in your configuration (pick0) file. To disable this feature for a single line, start the line with the -b option.
WARNING |
During boot, the ABS are written into the shared memory segment while it is not set to read only. After boot, line 0 remains unprotected until the process ends. To protect line 0 as well, log on to the dm account and type exit. Then restart line 0, if desired. |
NOTE |
In order to load ABS patches, this feature must be disabled, at least on the line that is loading the patches. Enter d3 -b from Linux, then log on and load the ABS patches. |
The amount of shared memory which D3 may allocate for itself (which will be some fraction of the total amount of physical memory) may be changed by modifying the core statement value in the D3 configuration file. The maximum size is 2.5 GB (or 3.5 GB if on 64 bit Linux) . The maximum size for 64bit D3 is limited to the amount of physical RAM on the system, minus a reasonable amount for Linux. This calculation determines the amount of required shared memory for D3:
core = D3 ABS size + (Total D3 processes * nnKB) + D3 application memory
Parameter(s)
D3 ABS size |
Size of the D3 ABS.
|
|
Total D3 processes |
D3 processes that are being executed. D3 processes include:
It should not include the total number of users and processes, but rather the maximum number of users that are consistently logged on at one time and the maximum number of processes that are consistently executing at the same time. For the multiplying factor nn:
(FlashBASIC applications transfer memory requirements to the UNIX side of shared memory and to UNIX swap space.) |
|
D3 application memory |
Amount of memory required by the application to perform its operation, that is, the amount of memory required to obtain suitable performance during file searching and sorting operations. This value may be estimated according to the size of the database as follows: |
|
Database Size |
Memory Requirements |
|
< 100 MB |
2500 KB |
|
100 - 200 MB |
3000 KB |
|
200 - 300 MB |
4000 KB |
|
300 - 400 MB |
5000 KB |
|
400 - 500 MB |
6000 KB |
|
500 - 600 MB |
6500 KB |
|
600 - 750 MB |
7500 KB |
|
> 750 MB |
1 % of the database size |
The amount of shared memory which D3 requires for FlashBASIC operations can be modified by changing the BASIC statement value in the D3 configuration file. BASIC shared memory is required only when applications are compiled with FlashBASIC. If FlashBASIC is not used, then the BASIC value is zero and this step may be omitted. The maximum size is 32 MB.
The calculation to determine the amount of required shared memory for FlashBASIC is:
BASIC = (Active FlashBASIC program size * 1.2 KB)
where an Active FlashBASIC program size is the amount of memory (in KB) used to hold all the Active FlashBASIC programs in memory at once. The definition of active here means only the programs running at the same time.
To determine Active FlashBASIC program size:
Start the D3 virtual machine.
Start all background processes.
Log on to all the active users.
Issue the command shpstat.
A similar screen displays:
Block |
Usage |
Size |
Name |
1 |
1 |
28k |
sales,bp sales.update |
2 |
2 |
39k |
inv,bp receiving |
3 |
1 |
42k |
gl,bp gen.led.entry |
2 |
|
992k |
(free) |
Free: |
992k |
Max Free: 992k Used: 109k |
Note the amount of Used memory.
Experimentation indicates that typical software packages require approximately 100 to 500 KB of shared memory per application. For example, all A/R users might use 500 KB and all G/L users might use 500 KB.
When first installing D3 or using FlashBASIC for the first time, it is difficult to determine the Active FlashBASIC program size. This parameter is determined by experimentation.
Install the system, and accept the default value.
After the system is installed and applications are running, determine the actual usage as above.
Change the values in the D3 configuration file accordingly.
See Also