DOCUMENT ID:  1196-02

SYNOPSIS:     Estimating Memory Requirements

OS RELEASE:   

PRODUCT:      Solaris x86

KEYWORDS:     estimate memory requirement system V


DESCRIPTION:

Estimating Memory for System V


SOLUTION:

Let's assume that you're running System V.  You have a handicap to work
against: ps won't really supply the information you need.  However, it
is still possible to estimate memory requirements using ps -el.  In this
case, you want to:

*  Use "file" to determine whether of not the process is shared
   text. Shared text files are either "pure" or "demand paged."
   Some System V versions of "file" don't give you this
   information. However, V.3 and V.4 make programs "shared text"
   by default, so you should assume that programs share their text
   segments unless you can prove otherwise.

*  If the process is not shared text, its data and stack sizes are
   given in 1-KB pages). Multiply this number by the number of
   invocations you expect; this is the total data and stack
   memory required for all invocations. To find the text size, use
   the command "size".

*  If the process shares its text segment, the SZ field only gives
   its data and stack size.  Multiply this number by the number of
   invocations you expect; this is the total data and stack memory
   required for all invocations. To find the text size, use the
   command "size". For example:

                # size /usr/local/bin/myprog
                20996 + 6080 + 3000 = 30076

   The first number is the program's text size. Add this number to
   the total data and stack area; the result is the total memory
   required (text, data, and stack) for all invocations of the 
   program.

For example, let's compute the amount of memory required to run four
invocations of myprog simultaneously.  Here's the data you need:

# file /usr/local/bin/myprog
/usr/local/bin/myprog: 80386 pure executable.
# ps -el
  F S UID       PID      PPID      C  PRI  NI      ADDR    SZ   WCHAN  TTY  TIME  CMD
...
 1  s 204   3603   67    0  30  20    8aa   364  14ec4  10  0:14  myprog
...
# size /usr/local/bin/myprog
20996 + 6080 + 3000 = 30076

"file" says this program is a pure executable, so we need to account for
the text and data/stack segments separately.  For each invocation, we
need to allow 364 KB for the data and stack segments.  For all
invocations, we need to allow for 20 KB for the executable.  Therefore,
the program's total requirement is 346*4+20 KB, or 1476 KB.  To estimate
the total system requirement, perform a similar computation for all the
programs your system will be running.  Don't forget to account for
daemons and other system processes.  **

** System Performance Tuning - O'Reilly & Associates, Inc.


DATE APPROVED: 10/10/95 
k