From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,30aabe88dfd2932c X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2000-12-12 10:56:45 PST Path: supernews.google.com!sn-xit-02!supernews.com!newsfeed.mesh.ad.jp!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!newsgate.tandem.com!mailint03.im.hou.compaq.com!nabeth.cxo.dec.com!alan From: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Newsgroups: comp.unix.tru64 Subject: Re: Total available free memory for new processes ? Date: 12 Dec 2000 18:56:21 GMT Organization: Digital Equipment Corporation Distribution: world Message-ID: <915scl$r1f$1@mailint03.im.hou.compaq.com> References: <3A36120B.B7A8211A@kmi-irm.oma.be> Reply-To: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) NNTP-Posting-Host: nabeth.cxo.dec.com X-Trace: mailint03.im.hou.compaq.com 976647381 27695 16.82.16.67 (12 Dec 2000 18:56:21 GMT) X-Complaints-To: usenet@mailint03.im.hou.compaq.com NNTP-Posting-Date: 12 Dec 2000 18:56:21 GMT Xref: supernews.google.com comp.unix.tru64:1162 In article <3A36120B.B7A8211A@kmi-irm.oma.be>, Alessandro Ipe 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 . 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