*BSD News Article 13878


Return to BSD News archive

Xref: sserve comp.unix.programmer:8782 comp.unix.questions:32762 comp.unix.bsd:11738 comp.sys.mips:2832
Newsgroups: comp.unix.programmer,comp.unix.questions,comp.unix.bsd,comp.sys.mips
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!doc.ic.ac.uk!pipex!sunic!psinntp!psinntp!sci.ccny.cuny.edu!sci.sci.ccny.cuny.edu!jeffrey
From: jeffrey@sci.sci.ccny.cuny.edu (Jeffrey L Bromberger)
Subject: getrusage(2) query
Message-ID: <1993Apr1.170330.18061@sci.ccny.cuny.edu>
Followup-To: comp.unix.programmer
Summary: measured in what?
Keywords: getrusage maxrss i?rss time
Sender: jeffrey@sci.ccny.cuny.edu (Jeffrey L Bromberger)
Reply-To: jeffrey@sci.sci.ccny.cuny.edu (Jeffrey L Bromberger)
Organization: City College of New York - Biology Department
Date: Thu, 1 Apr 1993 17:03:30 GMT
Lines: 49

This is a followup question to my previous one - how can a process
determine it's size.  Even though I wanted something portable, the
replies I received basically said use the BSD-ish getrusage(2) call.
So, that effectively cuts out the SysV crowd (no love lost on this front).

I wrote a quickie program to get the process size at the beginning,
allocate a chunk of memory, and do the diff of sizes.  Hopefully, the
results will be the same.  Well, not so.  Here's the data...

Memory Allocated    Vax/4.3BSD    DG Aviion/DGUX    MIPS/RISCos4.52
  in Mb              maxrss         maxrss              maxrss
======================================================================
   1                   2056          744                 227
   2                   4102         1768                 508
   4                   8200         3816                1037
   8                   ----         7192                2051
  16                   ----        16104                4123
  24                   ----        24296                6165
  32                   ----        32488                8236
  64                   ----        65256               14596

I gave up on the VAX after waiting for the 4Mb trial :-)

Analysis time...  The RSS value is listed as the "Maximum Resident Set
Size uiilized (in kilobytes)" from the 4.3BSD manuals, "Maximum
Resident memory size (in Kbytes)" from the DG's <sys/resource.h>, and
"maximum resident set size utilized (in pages)" on the MIPS platform.
Already we have a discrepancy on the units.  So much for portability :-(

Considering that the size of the executable does not change in memory,
and that the stack does not grow excessively (if at all), getrusage
returns wildly inaccurate numbers.  Why should 1Mb need 2056K on a
VAX, 744K on an Aviion, and 908K on a MIPS?  Just what is going on
here?

And you can forget using the idrss and isrss values - they are so time
dependent (KbyteSeconds) it's amazing.  Does *anyone* use these?
Except for billing (gasp)?

Any help would be greatly appreciated at this point.  I'm ripping my
hair out over this.  And I'm learning the hard way that anything more
than simple "Hello, world" is really non-portable.  Once the process
has to know about itself and it's environs, you're treading in a
highly variable twilight zone.

j
-- 
Jeffrey L. Bromberger ------ Biology Department ------ City College of New York
jeffrey@sci.sci.ccny.cuny.edu          Anywhere!{cmcl2,philabs}!ccnysci!jeffrey