2-24 IBM Informix OnLine Database Server Administrator’s Guide
How User Processes Attach to Shared Memory
How User Processes Attach to Shared Memory
OnLine requires a technique to ensurethat allOnLine user processes find and
gain access to the same shared-memory segments. If two or more OnLine
database servers exist on a single UNIX host machine, the shared-memory
segments associated with each OnLine server exist at different locations in
physical memory. The shared-memory segments for each OnLine server
must be uniquely identifiable to the database user processes.
The following list outlines the major steps that are completed when an
OnLine user process attaches to shared memory:
1. User process obtains SERVERNUM from configuration file.
2. User process calculates a shared-memory key value using
SERVERNUM.
3. User process requests a shared-memory segment using the shared-
memory key value. UNIX returns the shared-memory identifier for
the first shared-memory segment.
4. User process directs UNIX to attach the shared-memory segment to
its process space at SHMBASE.
5. If required, additional shared-memory segments are attached to be
contiguous with the first segment.
The tbinit daemon process creates the OnLine shared-memory segments
during initialization. (Refer to page 2-10.) Associated with each shared-
memory segment are two pieces of information:
■ A shared-memory key value
■ A shared-memory identifier
Step 1: Obtain SERVERNUM
When a user process directs the UNIX operating system to a shared-memory
segment, it defines the segment it needs using the shared-memory key value.
To attach to the segment, the user process must acquire from UNIX the shared
memory identifier that is associated with that segment. The UNIX operating
system uses these identifiers to track each shared-memory segment.