What is the best size for the swap partition?

Q First I would like to say that I'm new to the Linux world. I've read that the swap file should be twice the size of the machine's RAM but no more than 512MB. But in another guide I've seen "... a 2GB partition hda2 for the swap partition". I'm confused. Am I reading this right? Second, on a single machine can you run a Linux image under a Linux image? I know that there are other ways to do this, such as running VMware or VirtualBox, but I would like to know if you can do this.

A This is one of those questions that will get you a dozen different answers from ten different "experts" The traditional advice was that swap should be twice the machine's physical memory, but that comes from the days when most machines had only 64-128MB RAM. Some argue that with modern hardware having so much memory, swap is largely redundant. The opposite argument is that modern applications are capable of using that much memory, so swap is as relevant as ever. If you know you're going to be doing a lot of memory-intensive work, add plenty of swap. Losing a gigabyte or two of drive space is nothing compared with the inconvenience of your computer grinding to a halt because you have used up all the memory in a video editing session.

Some systems use tmpfs for the /tmp directory, speeding up the system by keeping temporary files in memory. These are usually small, but some programs do put large files in /tmp, and having some disk space to handle an overflow is a good thing. It is also common practice to use the swap partition for suspend-to-disk storage, particularly on laptops. In this case, the swap partition has to be at least as large as your physical RAM. On balance, I would still use 1-2 times the physical RAM for swap space, especially as hard drive sizes have grown even more quickly than RAM capacity. While it is possible to run a Linux distro within a window on your existing distro - after all, this can be done in Windows - I know of no distros specifically aimed at this.

This is probably because there are so many options for running virtual machines that can run any distro that creating a distro specifically for this task would be rather pointless (but if anyone knows of such a distro/app, please let us know). With a choice of VMware, VirtualBox, Qemu and Xen, you already have plenty of options for running Linux within Linux, and more securely because a virtual machine protects the host from the guest's processes.