Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Aug 1999 14:06:56 -0700
From:      David Greenman <dg@root.com>
To:        "Ronald F. Guilmette" <rfg@monkeys.com>
Cc:        Dan Nelson <dnelson@emsphone.com>, questions@FreeBSD.ORG
Subject:   Re: Per-process memory overhead 
Message-ID:  <199908092106.OAA08248@implode.root.com>
In-Reply-To: Your message of "Mon, 09 Aug 1999 12:53:10 PDT." <19652.934228390@monkeys.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
>You are correct, of course.  The executable code pages are all shared
>between these many separate (process) instances of this program.  So only
>the data and stack space for each process are an issue.
>
>As I said, the program is VERY small and simple.  Now, I have it down to
>the point where each instance of the program really only uses a single
>4 KB page of memory dor data space and a single 4 KB page for stack space.

   You should have some amount of bss as well as data.

>So now each running instance of the program should really only take up
>8 K bytes... after the executable code pages are factored out... right?
>
>WRONG!
>
>Each executing instance of this program now shows up as having an RSS of
>36 KB.  I _know_ that 12 KB of that is the (sharable) text segment, so that
>leaves 24 KB, per process, to account for.  Of that 24 KB, I already know
>that the program itself is using 8 KB (for data and stack).  But note that
>this still leaves 16 KB per process unaccounted for.
>
>So OK.  Three questions:
>
>1) Where is this extra 16 KB per-process overhead coming from?

   The RSS includes the space for the process page directory (1 page) and page
tables (2 pages), so 12KB. There is also the kernel stack and u area, which is
a total of 2 pages. Your minimum process private data size should thus be
1+2+1+1+1+1+1 (pd+pts+ks+u+stack+bss+data) = 8 pages or 32KB.

>2) How can I eliminate most of all of it?

   You're at the bone already. You could get rid of one page table page by
playing games with the program's load/start address (i.e. put it within the
same 4MB segment where the stack resides).

>That is equal to 1/4 of all of the memory that was even available on the
>original PDP-11s that first ran BSD UNIX!  I really do think that this
>amount of overhead, per process, may be difficult to justify.

   They weren't virtual machines and don't have the associated overhead.

-DG

David Greenman
Co-founder/Principal Architect, The FreeBSD Project - http://www.freebsd.org
Creator of high-performance Internet servers - http://www.terasolutions.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908092106.OAA08248>