Skip site navigation (1)Skip section navigation (2)
Date:        Wed, 3 May 2000 01:49:47 +0200
From:      Erik Trulsson <ertr1013@student.csd.uu.se>
To:        Phil Homewood <pdh@bit.net.au>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: BSD Theology: swap, /var, /tmp and /usr/tmp
Message-ID:  <20000503014946.A3707@student.csd.uu.se>
In-Reply-To: <20000503093249.A22805@atlas.bit.net.au>; from pdh@bit.net.au on Wed, May 03, 2000 at 09:32:50AM %2B1000
References:  <390F41FD.5880279E@telinco.net> <20000503012329.A3265@student.csd.uu.se> <20000503093249.A22805@atlas.bit.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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