Attach additional shared-memory segments

To attach additional shared-memory segments, a virtual processor requests them from the operating system in much the same way that it requested the first segment.

Each virtual processor must attach to the total amount of shared memory that the database server has acquired. After a virtual processor attaches each shared-memory segment, it calculates how much shared memory it has attached and how much remains. The database server facilitates this process by writing a shared-memory header to the first shared-memory segment. Sixteen bytes into the header, a virtual processor can obtain the following data:
  • The total size of shared memory for this database server
  • The size of each shared-memory segment
For the additional segments, however, the virtual processor adds 1 to the previous value of shmkey. The virtual processor directs the operating system to attach the segment at the address that results from the following calculation:
SHMBASE + (seg_size x number of attached segments)

The virtual processor repeats this process until it has acquired the total amount of shared memory.

Given the initial key value of (SERVERNUM * 65536) + shmkey, the database server can request up to 65,536 shared-memory segments before it can request a shared-memory key value used by another database server instance on the same computer.


Copyright© 2019 HCL Technologies Limited