Uno Engborg wrote:
Would I need a swap anyway. There is some old rule of thumb to have
twice as much virtual memory as you have physical RAM, but that
sounds a bit ridiculous as it would take a lot of time to swap
in/out this much memory from disk.
I used to think it was kind of ridiculous, myself, until I discovered a
quirk of Posix's behavior. If I get any of these details wrong, I
invite corrections:
When a process called fork() on an old unix system, the OS required an
amount of free memory equal to the size of the process, plus the size of
a process table entry. If this memory wasn't free, fork() would fail.
After fork(), the OS would copy the full set of memory from the parent
process to the new process. Since fork() is so often followed by
exec(), which throws away all of that memory, modern unix systems don't
copy the whole set of memory when a process forks. However, they still
require that there is enough memory to do so (at least normally; Linux
has an "overcommit" feature that you can enable).
With 8GB of RAM, that may not affect you directly, but it may, too.
Lets say that you have no swap, and you were using a 3d modeler, or
high-end graphics package. If that application was using 5GB of your 8,
and needed to launch a helper application, like an out-of-process perl
or python script, it wouldn't be able to do so. Even though that script
only needs a few MB of the GB you have free, the parent is too big to
fork(), so it can't spawn new processes.
So, when you decide whether or not to follow the traditional advice
offered about the amount of swap to allocate, you should first
understand how the Linux VM works:
http://www.redhat.com/magazine/001nov04/features/vm/
...if you don't want to spend the time learning the details, I'd just
stick with the advice offered.