Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Aug 1996 11:31:44 +0200 (IST)
From:      Nadav Eiron <nadav@barcode.co.il>
To:        dwhite@resnet.uoregon.edu
Cc:        Scott Blachowicz <scott@statsci.com>, Eric Berenguier <Eric.Berenguier@sycomore.fr>, questions@FreeBSD.ORG
Subject:   Re: FreeBSD 2.1.0 CRASH! 
Message-ID:  <Pine.BSF.3.91.960831111413.10783B-100000@gatekeeper.barcode.co.il>
In-Reply-To: <Pine.BSI.3.94.960830223422.267M-100000@gdi.uoregon.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

On Fri, 30 Aug 1996, Doug White wrote:

> On Thu, 29 Aug 1996, Scott Blachowicz wrote:
> 
> > Doug White <dwhite@gdi.uoregon.edu> wrote:
> > 
> > > Your swap is a bit small for your memory -- suggested is 2xmemory.
> > > Although running out of swap won't illicit a panic (usually), it would be
> > > something to consider.
> > 
> > I've never really quite figured out that recommendation...unless you're
> > assuming that the system has the "right" amount of RAM to reasonably run all
> > the applications you want to run on it. In that case, the "2 x RAM" amount
> > is really an indirect way of saying how much swap you need to run your
> > applications. The amount of swap space should be more related to how much
> > stuff you want to have in memory at one time, I would think.
> 
> I wish I knew the exact history behind it myself :-), but in my experience
> it's been a good "yardstick", at least for starters.  Obviously, you don't
> have to adhere to it (I could probably get by with 50mb on my 32MB RAM
> workstation since I'm running X and not using swap), but again it's a
> starting point.
> 
> > The size of the recommendation should change depending on whether or not
> > the swap area is the total virtual address space or just an extension of
> > the RAM (i.e.
> > 
> >   sizeof(virtual addr space) == sizeof(RAM)+ sizeof(swap)
> > 
> > instead of just
> > 
> >   sizeof(virtual addr space) == sizeof(swap)
> 
> FreeBSD uses method #1.  It's all the same to the VM system.
> 
> > ). If on a system doing the latter, 20Mb is definitely not enough swap for
> > 16Mb of RAM.  I don't really know which category FreeBSD falls into (it
> > could be that any recent OS uses the former method...I don't know).
> 
> I don't know of any OSs that consider the swap to be total memory
> available.  The three that I know of that use swap other than UNIXen are
> OS/2, Windows95 and Windows, and they use method #1 too.  

If we're bringing other OS's into the picture... (no flames please :-)). 
All OS's I know of use method 1 (don't see a reason not to). The two 
schools of swap space allocation differ in another point: global 
replacement algorithms vs. local replacement algorithms. Global 
replacement means that when deciding on a page to swap out, the OS 
doesn't care about what process owns the page, and only looks at when it 
is used. Local replacement means that different processes are handled 
differently (it's called local, because in its steady state, when a 
process wants memory, it tends to page out a page that belongs to the 
same process).

BSD uses global replacement. As "The Design and Implementation of 4.4BSD" 
states, global replacement is easier to implement and manage. The one O.S.
I know that uses local replacement is VMS (that book also mentions it in
that context), and its younger clone, WinNT. The point is that when you
use local replacement you can control how much swap space a process is
going to ever get (it's called VIRTPAGCNT in VMS), and thus calculate how
much swap space you'll need before it's needed (however, you need to
manage those parameters, and many other, manually, and they are usually
not set correctly as most managers don't fully understand the ver complex
paging and swapping algorithms in VMS). This way, VMS can tell you when 
you have the chance of running out of paging space (I think NT does this 
too, giving the message "System is running low on virtual memory") long 
before it causes any ill effects (as most processes don't eat up all the 
memory at once). As "The Design and Implementation of 4.4BSD" says, the 
decision not to use those algorithms in BSD may cause processes to be 
killed and even the system to crash when swap space is exhausted.

Bottom line is that if you used VMS you'd probably be noticing that your 
pagefiles have *negative* reserved space left long before anything bad would 
happen. However, if you used VMS your bank account would also show a 
negative balance before you get anything done :-).

Life is full of compromises!

> 
> Doug White                              | University of Oregon  
> Internet:  dwhite@resnet.uoregon.edu    | Residence Networking Assistant
> http://gladstone.uoregon.edu/~dwhite    | Computer Science Major
> 
> 

Nadav



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.960831111413.10783B-100000>