Paul Kraus wrote:
> Says to double your ram to create your swap file then it contradicts
> itself. Can someone explain exactly how this should be done and maybe
> some theory behind it? I don't just like knowing how I like to now why.
> Thanks.

Paul,

I am *not* an expert, but this is my understanding, and I'm putting it
out here partly so others can correct me.  I think it is mostly correct.

Some of it may be unexplainable (except by a kernel developer), and it
also depends on what version of the kernel you are using.

In general, swap is used to keep the system going when there is no more
free RAM.  Things in RAM that haven't been used for a while are sent to
the swap, and new things (program or data) that need the newly freed RAM
can use it.  (I'm staying away from buffers, free buffers, etc.)

I've heard the two times RAM rule for quite a while, but when I dug
deeper the "more precise recommendation" was to do some test runs for
your system, see how much RAM each of your applications used, and then
make sure you had enough RAM plus swap to satisfy the total RAM demand.
For instance, if you ran two copies of AbiWord, 10 of Konqueror, etc.,
etc..  Note that an additional instance of a program doesn't always use
twice the RAM of a sincle instance -- pay attention to top or free as
you start and run additional programs.

Two other things to consider are:
   * When your system starts using swap, it is slower than if you have
enough RAM to avoid swap
   * If you don't have swap and your system runs out of RAM, bad things
can happen (don't know if it's necessarily a crash, or exactly what will
occur)

I think that recommendations like "you don't need swap if you have 512
MB of RAM" are based on an assumption that you (no normal user) would
ever run enough stuff to use all that RAM, and thus swap is not
required.  That assumption is not necessaily true.  You have to check
your system and your program mix.  On the other hand, if you're running
512 MB RAM and run out, maybe the corresponding assumption that these
recommender's are making is that you're running something that you don't
mind spending money on and you'll go out and buy more RAM if necessary. 
(I hear about servers and things like that running gigabytes of RAM.)

But, if you do have a sufficient amount of RAM, you can forego swap
entirely.

Another piece of the puzzle is that there was some sort of bug or
problem in some of the 2.4 kernels (IIRC).  (I think some related
problems or questions are still trying to be resolved.)  As a result of
those problems, a recommendation came out (from the kernel developers or
maintainers, I believe), that said swap space of less than 2 times RAM
was not useful, if you used swap on those kernels, it had to be at least
2x RAM.  I can speculate on the reason, but I don't really know.

hope that helps, and I look forward to corrections or clarifications
from anybody,
Randy Kramer

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to