Next | Prev | Up | Top | Contents | Index

Interrogating the Memory System

You can get information about the state of the memory system with the system calls shown in Table 1-1.

Memory System Calls
Memory InformationSystem Call Invocation
Size of a pageuiPageSize = getpagesize();
ulPageSize = sysconf(_SC_PAGESIZE);
Virtual and resident sizes of a processsyssgi(SGI_PROCSZ, pid, &uiSZ, &uiRSS);
Maximum stack size of a processuiStackSize = prctl(PR_GETSTACKSIZE)
Free swap space in 512-byte unitsswapctl(SC_GETFREESWAP, &uiBlocks);
Total physical swap space in 512-byte unitsswapctl(SC_GETSWAPTOT, &uiBlocks);
Total real memorysysmp(MP_KERNADDR, MPSA_RMINFO, &rmstruct);
Free real memorysysmp(MP_KERNADDR, MPSA_RMINFO, &rmstruct);
Total real memory + swap spacesysmp(MP_KERNADDR, MPSA_RMINFO, &rmstruct);

The structure used with the sysmp() call shown above has this form (a more detailed layout is in sys/sysmp.h):

struct rminfo {
   long freemem; /* pages of free memory */
   long availsmem; /* total real+swap memory space */
   long availrmem; /* available real memory space */
   long bufmem; /* not useful */
   long physmem; /* total real memory space */
};
A sample program that applies swapctl() and sysmp() to display these numbers is shipped in the 4DGifts example directory. See ~4Dgifts/examples/unix/irix/freevmen.c



Next | Prev | Up | Top | Contents | Index