From owner-freebsd-questions Mon Aug 9 14:13:57 1999 Delivered-To: freebsd-questions@freebsd.org Received: from implode.root.com (root.com [209.102.106.178]) by hub.freebsd.org (Postfix) with ESMTP id 647B414D75 for ; Mon, 9 Aug 1999 14:13:55 -0700 (PDT) (envelope-from root@implode.root.com) Received: from implode.root.com (localhost [127.0.0.1]) by implode.root.com (8.8.8/8.8.5) with ESMTP id OAA08248; Mon, 9 Aug 1999 14:06:56 -0700 (PDT) Message-Id: <199908092106.OAA08248@implode.root.com> To: "Ronald F. Guilmette" Cc: Dan Nelson , questions@FreeBSD.ORG Subject: Re: Per-process memory overhead In-reply-to: Your message of "Mon, 09 Aug 1999 12:53:10 PDT." <19652.934228390@monkeys.com> From: David Greenman Reply-To: dg@root.com Date: Mon, 09 Aug 1999 14:06:56 -0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >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