2-26 IBM Informix OnLine Database Server Administrator’s Guide
How User Processes Attach to Shared Memory
The first shared-memory segment is attached to the virtual address space of
each process at the same virtual address defined as SHMBASE. SHMBASE
identifies the specific virtual address where the database server processes
attach the first, or base, shared-memory segment. (Refer to Figure 2-2 on
page 2-23 for an illustration of the virtual address space of a database server
process.)
The reason that all user processes share the same SHMBASE value is to speed
execution. All user processes can reference locations in shared memory
without recalculating shared-memory addresses because all addresses begin
at the same base address. All addresses assume that shared memory begins
at the address specified as SHMBASE. That is, all addresses are relative to
SHMBASE. If each user process attached to shared memory at a different
location, shared-memory addresses would be relative to the start of shared
memory and would have to be recalculated for each user process, slowing
execution.
The specific value of SHMBASE is often machine-dependent. It is not an
arbitrary number. Informix selects a value for SHMBASE that will keep the
shared-memory segments safe in case the user process dynamically acquires
additional memory space.
Different UNIX systems accommodate additional memory at different virtual
addresses. Some UNIX architectures extend the highest virtual address of the
user process data segment to accommodate the next segment. In this case, it
is possible that the data segment could grow into the shared-memory
segment.
The server process function stack or (heap) can pose another threat. Some
UNIX architectures begin the function stack at a high virtual address to keep
it clear of the growing data segments. If the stack begins too close to the
shared-memory segments, the stack can overwrite the end of shared memory.
Some versions of UNIX require the user to specify a SHMBASE of virtual
address of 0. The 0 address informs the UNIX kernel that the kernel should
pick the best address at which to attach the shared-memory segments. This
kernel-selects option is an attempt to respond to the many different ways that
an application can affect the growth of the server process . However, all UNIX
architectures do not support the kernel-selects option. Moreover, the kernel’s
selection is not always the best choice for all applications.
Informix recommends that you do not attempt to change the value of
SHMBASE.