Michael Jones (mtj++at++babar)
Fri, 4 Feb 1994 09:41:01 -0800
The default allocation is 256MB. This issue has been dealt with in the
upcoming 1.2 release of IRIS Performer with the new pfSharedArenaSize()
function: just call it before your pfInit() call. Here's the reference
page for the new functions (also pfSharedArenaBase() can be handy too).
pfSharedMem(3pf) Silicon Graphics pfSharedMem(3pf)
NAME
pfInitArenas, pfGetSharedArena, pfGetSemaArena, pfTmpDir, pfGetTmpDir,
pfSharedArenaSize, pfGetSharedArenaSize, pfSharedArenaBase,
pfGetSharedArenaBase - Shared Memory Functions
C SPECIFICATION
#include <pr.h>
long pfInitArenas(void);
void * pfGetSharedArena(void);
usptr_t * pfGetSemaArena(void);
void pfTmpDir(char *dirname);
const char* pfGetTmpDir(void);
void pfSharedArenaSize(ulong size);
ulong pfGetSharedArenaSize(void);
void pfSharedArenaBase(void *base);
void * pfGetSharedArenaBase(void);
DESCRIPTION
pfInitArenas creates a shared memory arena that can be used to allocate
memory, locks and semaphores from (see pfMalloc, pfNewSema, pfNewLock).
This function is called by pfInit so it is not necessary to call it when
using libpf functions. Calling pfInitArenas again after using pfBlist,
pfBpipe, pfQueue, pfNewLock, pfNewSema will have adverse affects due to
the resetting of internal data structures.
pfInitArenas uses usinit to create arenas for both locks and shared
memory. These arenas are reflected in the Unix file system. Where these
files are created is important. There must be as much space available to
the file as is allocated for the arenas. 16K bytes are allocated for the
locks and semaphores, which supports approximately 4K locks.
pfTmpDir and the environment variablle PFTMPDIR control where
pfInitArenas creates its arenas. If neither is specified, the semaphore
arena is created in /usr/tmp and the shared memory arena is created in
/dev/zero (swap space). If a temporary directory is specified, then
files are created in that directory for the shared memory and semaphore
arenas. Both these files are unlinked so that they are removed from the
file system when the process terminates. Once created, these arenas
cannot grow, so Performer tries to create a large (256MB) arena.
For shared memory, swap space, the default, is usually preferable to
using a file in a directory specified by PFTMPDIR. Using an actual file
is slightly slower at allocation time and requires actual disk space for
extending the file length to equal the amount of memory allocated
(pfMalloc) from the arena.
Swap space under 4.0.5 is not resevered or allocated until pfMalloc, so
Performer can create a large arena without tying up actual swap space
until it's used by pfMalloc. But under 5.0.1/5.1, arena space needs to
be reserved up front. In this case, Performer limits the size of its
shared memory arena to a fraction of the currently available swap space.
This may cause some moderate or large applications to fail during
pfMalloc. To avoid this problem under 5.0.1/5.1, increase the virtual
size of swap space by creating a zero length file called /swap and adding
a line to /etc/fstab:
/swap swap swap vlength=5000000
and reboot the system. Under 5.1.2, this is no longer necessary since
Performer uses a new IRIX mechanism for reserving swap space as the arena
usage grows.
pfSharedArenaSize can be used to override the arena size that Performer
uses by default (256MB). size specifies the desired size in bytes.
pfGetSharedArenaSize returns the arena size in bytes.
pfSharedArenaBase sets the base address for the mapping of the shared
memory arena. Normally, IRIX chooses the base address. This is useful
if the application needs closer control over the layout of virtual
address space, e.g. to avoid conflicts with other mappings.
pfGetSharedArenaBase returns the base address for the arena.
pfGetSemaArena returns a handle to the lock arena and pfGetSharedArena
returns a pointer to the shared memory arena. This pointer cannot be
used directly, only as an argument to pfMalloc. pfGetTmpDir returns the
temporary directory set using pfTmpDir.
NOTES
These arenas can only be used by related processes. Meaning those
processes that share a common heritage. Use pfDataPool for sharing
memory between unrelated processes. pfInitArenas should be called before
any other forks or sprocs are made.
SEE ALSO
acreate, usinit, pfMalloc, pfFree
--Be seeing you, mtj++at++sgi.com 415.390.1455 M/S 7L-590 Michael Jones Silicon Graphics, Advanced Graphics Division 2011 N. Shoreline Blvd., Mtn. View, CA 94039-7311
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:10 PDT