From owner-freebsd-questions Tue May 2 16:50:12 2000 Delivered-To: freebsd-questions@freebsd.org Received: from merganser.its.uu.se (merganser.its.uu.se [130.238.6.236]) by hub.freebsd.org (Postfix) with ESMTP id 75E2237BBBC for ; Tue, 2 May 2000 16:50:10 -0700 (PDT) (envelope-from ertr1013@student.csd.uu.se) Received: from regulus.student.UU.SE ([130.238.5.2]:59388 "HELO ertr1013.student.csd.uu.se") by merganser.its.uu.se with SMTP id ; Wed, 3 May 2000 01:49:51 +0200 Received: (qmail 3802 invoked by uid 1001); 2 May 2000 23:49:47 -0000 Date: Wed, 3 May 2000 01:49:47 +0200 From: Erik Trulsson To: Phil Homewood Cc: freebsd-questions@FreeBSD.ORG Subject: Re: BSD Theology: swap, /var, /tmp and /usr/tmp Message-ID: <20000503014946.A3707@student.csd.uu.se> References: <390F41FD.5880279E@telinco.net> <20000503012329.A3265@student.csd.uu.se> <20000503093249.A22805@atlas.bit.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20000503093249.A22805@atlas.bit.net.au>; from pdh@bit.net.au on Wed, May 03, 2000 at 09:32:50AM +1000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, May 03, 2000 at 09:32:50AM +1000, Phil Homewood wrote: > Erik Trulsson wrote: > > The idea behind the 2*memory rule is basically that if you need to use more > > memory than twice your physical memory the system will have such lousy > > performance due to all the swapping that you really want more RAM. > > My understanding was as follows: > > * Suppose you have N Mb of RAM. Assume that N is relatively large > such that kernel footprint and minimal necessary processes > occupy negligible fraction of N. > > * Suppose you have a process P which needs to use around N Mb of RAM. > Suppose that all RAM is in use. (ie, worst case for swapping.) > > If you have less than 2*N swap, you do not have enough room to swap > out everything else in the N Mb of RAM to swap in (and out) the N Mb > image required by process P in one hit, so you need to do it in > smaller chunks, which thrashes the disk. > > If you have > 2*N Mb of swap (plus any required for other swapped > out processes) then you can swap the image of P in and out with > minimal overhead. > > Is this correct? Not really. In the old days whole processes was swapped in and out at a time so then it mighat have been correct. These days you just bring seperate pages in and out of swap when needed. So in the example above it is quite likely that the when you actually run out of RAM it is part of process P that will be swapped out when P tries to use the last of those N MB of memory. So you only swap in/out those parts of processes that are actually needed. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message