
System Architecture 2-25
How User Processes Attach to Shared Memory
Step 2: Calculate Shared-Memory Key Value
Whenauserprocessisreadytoattachtosharedmemory, itcalculatesavalue
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
fromindependent OnLines do not becomeentangled, the key value mustbe
unique for each OnLine system.
The shared-memory key value that eachuser process arrivesat is definedby
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
databaseserver exists ona single host machine,thecalculatedkey values are
separated by the difference between the two values of SERVERNUM, multi-
plied by 65536.
The value of shmkey is set internallyand cannotbe changedby theuser. (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 processtransfers 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.
Comentários a estes Manuais