MAINSAIL System-Specific User's Guides, Chapter 7

previous   next   top   complete contents   complete index   framed top   this page unframed


7. UNIX Shared Mapped Library and Kernel Support

On UNIX systems that permit it, MAINSAIL object MODULE libraries and the MAINSAIL kernel MODULE are memory-mapped so that their code can be shared among processes. This improves performance where multiple MAINSAIL processes are run at the same time on the same machine.

7.1. Systems Where Mapping Is Automatic

The majority of UNIX systems provide the mmap system call. On those systems, memory mapping is automatic; you do not need to do anything in particular to take advantage of memory mapping on these systems.

7.2. Systems Where Mapping Is Not Automatic: HPPA, HPPA64, and RAIX before OS Version 3.2

On some platforms (currently HPPA, HPPA64, and the versions of the RAIX operating system before 3.2), it is not possible to map files automatically, but you can still perform a procedure manually that will subsequently permit MAINSAIL to share specified files.

To share the MAINSAIL kernel or a MAINSAIL object MODULE library, you must run the MAINSAIL MODULE SHMCTL to tell the operating system about the files you wish to share. You must repeat this procedure every time the operating system is rebooted. In addition, you must build MAINSAIL bootstraps with a special bit set in UNIXBITS, or they will not be able to take advantage of the information provided to the OS by SHMCTL.

7.3. Running SHMCTL

To share an object library (or the MAINSAIL kernel), run the MAINSAIL MODULE SHMCTL and specify the command add fileName for each file to be shared. You must specify the full path name of the file as the file name will be passed to openLibrary or as the file name is specified in the MAINSAIL bootstrap.

Then run CONF and create a bootstrap with the 'H100 bit set in the UNIXBITS parameter. The resulting bootstrap will share the files that were specified to SHMCTL.

On RAIX, the MAINSAIL kernel MODULE can be shared as well as MAINSAIL object libraries. On HPPA and HPPA64, only libraries can be shared; the kernel MODULE cannot.

If you delete or modify a shared file, you should also delete the corresponding shared segment. The person who runs SHMCTL to delete a segment has to be the same user as the one who added it. However, anyone can use the segment regardless of who created it.

To confirm that you have successfully created and are using a shared section, you may want to run MM and issue the m command before running SHMCTL, and then run MM again under the new bootstrap after running SHMCTL. The MM m command prints out (among other things) the number of mapped library pages used by the current process. The number should be 0 before running SHMCTL and nonzero afterwards.

Example 7–1 shows all the steps needed to create a shared section, build a bootstrap that uses it, and confirm that the shared section is being used. The example is for HPPA, where only the system library (as displayed by the SYSTEMLIBNAME parameter after CONF's show command) can be shared. On RAIX, where you can share the MAINSAIL kernel MODULE as well, you should specify an additional add command to SHMCTL, taking the argument from the CONF KERMODNAME parameter. Be aware also that the commands used to compile and link a bootstrap vary from platform to platform; check Section B.3 for details.

Example 7–1. Example Use of SHMCTL on HPPA
mainsa<eol>
...
*
mm m<eol>

pageAdr (B=static ...)
-------
'
H40056000   BBBBBBDDDB ... bbbbbbbbbD
'
H4006F000   DDDSssssss ... cccDDDDCcc
'
H40088000   cccccccccc ... cccccccccc
'
H400A1000   ccDCcccccc ... cccccDCccc
'
H400BA000   ccccccCccc ... cccCcccccc
'
H400D3000   cccccccccc ... cccccccccc
'
H400EC000   ccccccDd
308 
total pages: 46 B, 218 C, 28 D, 16 S, 0 .
mapped library pages

To build the bootstrap and create the shared section:

CONFshow<eol>
Current configuration values:
BOOTFILENAME mainsa
      .
      .
      .
UNIXBITS 'H2002
      .
      .
      .
CONFunixbits =!'H100<eol>
CONFbootfilename sharedmainsa<eol>
CONF<eol>
Bootstrap written in file sharedmainsa.s
*
shmctl<eol>
SHMadd /usr/mainsail/16.30.1/sys-upa.olb<eol>
Creating shared segment (this may take a moment)...
Created segment with ID 119339372 for file
    
/usr/mainsail/16.30.1/sys-upa.olb
SHMquit<eol>
*
<eol>
cc -o sharedmainsa sharedmainsa.s /usr/mainsail/16.30.1/m.o<eol>
sharedmainsa<eol>
...
*
mm m<eol>

pageAdr (B=static ...)
-------
'
H40056000   BBBBBBDDDB ... bbbbbbbbbD
'
H4006F000   DDDSssssss ... sssssssDDd
167 
trailing free pages
257 
total pages: 46 B, 0 C, 28 D, 16 S, 167 .
4097 
mapped library pages

Shared segments last only until your computer is rebooted. Because it is inconvenient to remember to run SHMCTL every time you reboot your system, you may want to run it automatically at system startup time (e.g., by putting the commands to run it in rc.local).

On some systems, you may be unable to create a shared segment for the MAINSAIL system library, because some systems limit the maximum shared segment size to a relatively small value.

7.4. Disabling Automatic Mapping

On systems other than HPPA, HPPA64, and RAIX before OS Version 3.2, you can create a bootstrap that disables automatic memory mapping of libraries and the kernel MODULE by setting the UNIXBITS parameter to include the bit 'H4000.

In general, it is not advisable to set this bit. However, if you should encounter problems with mapped libraries, you may wish to do so.

7.5. Caveats

Be careful not to run SHMCTL on the RAIX OS Version 3.2 or later unless automatic mapping has been disabled, as described in Section 7.4. The RAIX documentation warns:

Thus, SHMCTL is incompatible with the mapping that takes place automatically under later versions of the OS.


previous   next   top   complete contents   complete index   framed top   this page unframed

MAINSAIL System-Specific User's Guides, Chapter 7