Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.)
Subject: Re: Total available free memory for new processes ?
Date: 12 Dec 2000 18:56:21 GMT	[thread overview]
Message-ID: <915scl$r1f$1@mailint03.im.hou.compaq.com> (raw)
In-Reply-To: 3A36120B.B7A8211A@kmi-irm.oma.be


In article <3A36120B.B7A8211A@kmi-irm.oma.be>, Alessandro Ipe <Alessandro.Ipe@kmi-irm.oma.be> writes:
>
>Our team needs to run an operational application that required a fixed &
>large amount of memory. This application will be executed regularly,
>i.e. each 15 min, so before running, we would like to check if there is
>still sufficient amount of total free memory on the system to guarantee
>that it will finish without memory allocation errors. Is there a system
>command or function which can tell what is the maximum total amount of
>memory available for new processes, i.e. which takes into account
>virtual memory, buffer cache memory, etc.... ?

From the description it sounds like what you really want it to know the
amount of available page/swap space and the amount that is reserved.
This assume you're running with in "eager" page/swap reservation mode.

The swapon(8) command will show the amount of available, reserved
and allocated page/swap space.  The available and allocated parts
probably come from kernel tables that store information about each
page/swap space.

If you want to get the data from a program of your own, it gets
harder.  Some of the kernel data used by swapon(8) is available
via the table(2) system call using the TBL_SWAPINFO code.  The
data structure is described in <sys/table.h>.

The amount of reserved space is also kept by the kernel, but there
doesn't seem to be a documented interface to get the data.  In V4
and earlier, it was necessary to open /dev/kmem, seek to the right
address and read the data directly.  On V5, the data is equally hard
to get, but has been moved to a single kernel data structure.  You
can get the current Monitor sources from:

ftp.digital.com:/pub/DEC/monitor.alpha.tar.Z

to see how I did it in both cases.  Or, you can run swapon(8) using
a popen(3) call and parse the output.  Sometimes this is the best
way of getting the information.

So far I've concenrated on available page/swap space.  That's because
it is most relevant to whether an allocation will succeed.  For actual
"free" page of memory, vmstat(1) is your best choice.  This isn't
particularly useful since heavy buffer cache usage can cause the
free memory to appear very low.  However, if the data isn't in the
buffer cache isn't very dirty, getting back the memory is cheap.

Getting the data from swapon(8) isn't trivially easy method you're
looking for, but I think it is the way to go.

>
>For info, we are running Tru64 v4.0F on a DS20E system.
>
>
>Many thanks,
>
>
>Alessandro.
>
>
>
>
>
--
Alan Rollow				alan@nabeth.cxo.dec.com



  reply	other threads:[~2000-12-12 18:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-12 11:54 Total available free memory for new processes ? Alessandro Ipe
2000-12-12 18:56 ` Alan Rollow - Dr. File System's Home for Wayward Inodes. [this message]
2000-12-13  2:10 ` Stuart R. Fuller
2000-12-19 19:27 ` Jack Patteeuw
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox