2-26 IBM Informix OnLine Database Server Administrator’s Guide
How User Processes Attach to Shared Memory
Thefirst shared-memory segment is attached to the virtual address space of
each process at the same virtual address defined asSHMBASE.SHMBASE
identifies the specific virtual address where the database server processes
attach the first, or base, shared-memory segment. (Refer toFigure 2-2 on
page 2-23 foran illustration of the virtual address space of a database server
process.)
Thereason that all user processes share the same SHMBASE value is to speed
execution. All user processes can reference locations in shared memory
withoutrecalculating shared-memory addresses because all addresses begin
at the same base address. All addresses assume that shared memory begins
at the address specified asSHMBASE. 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 ofSHMBASE is often machine-dependent. It is not an
arbitrary number. Informix selects a value forSHMBASE that will keep the
shared-memorysegments safe in case the user process dynamically acquires
additional memory space.
DifferentUNIX systems accommodate additional memory at different virtual
addresses.Some UNIX architectures extend the highest virtual address of the
userprocess 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
UNIXarchitectures 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-memorysegments, the stack can overwrite the end of shared memory.
Some versions ofUNIX require the user to specify aSHMBASE of virtual
address of 0. The 0 address informs theUNIX kernel that the kernel should
pick the best address at which to attach the shared-memory segments. This
kernel-selectsoption is an attempt to respond to the many different ways that
anapplication can affect the growth of the server process . However, all UNIX
architecturesdo 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.