IBM 000-8697 User Manual

Page of 702
System Architecture
2-25
How User Processes Attach to Shared Memory
Step 2: Calculate Shared-Memory Key Value
When a user process is ready to attach to shared memory, it calculates a value
that serves as the shared-memory key to identify to
UNIX
 the first shared-
memory segment. To ensure that all user processes within a single OnLine
system attach to the same shared-memory segments, the key value must be
shared among all OnLine user processes. To ensure that the user processes
from independent OnLines do not become entangled, the key value must be
unique for each OnLine system.
The shared-memory key value that each user process arrives at is defined by
the calculation:
(SERVERNUM * 65536) + shmkey
The database configuration parameter
SERVERNUM
 uniquely identifies the
shared-memory segments for each OnLine system. If more than one OnLine
database server exists on a single host machine, the calculated key values are
separated by the difference between the two values of
SERVERNUM,
 multi-
plied by 65536.
The value of shmkey is set internally and cannot be changed by the user. (The
shmkey value is 52564801 in hexadecimal representation or 1,381,386,241 in
decimal.)
The value (
SERVERNUM
* 65536) is the same as multiplying
SERVERNUM
by
hexadecimal 1000.
Steps 3 and 4: Request Shared-Memory Segment and Attach to
SHMBASE
The user process transfers to
UNIX
the calculated shared-memory key value.
In return, the
UNIX
 operating system passes back the shared-memory
segment identifier associated with the value of the shared-memory key.
Using this identifier, the user process requests that the operating system
attach this segment of shared memory to the user process space at the
address specified as the OnLine configuration parameter
SHMBASE
.