Swaps are the virtual memories used by OS when its ram is fill up and can't store more of data. Then less important data are freed from ram and store into swaps. Unlike what many people believe Linux support swap as files also like in windows paging file but they are have certain disadvantages but still they can be manage easily.

Also if you want swap and have two hard disks you are advised to create a swap partition on each.
Normally a user don't need swap more than 1/2 gb. That 2.x formula is deprecated. You want you can create 16 terabytes of swap in a opteron. It depends upon your use.
To create swap file:
First determine how much swap you want.
If you want 2 gb then you have 2048 mb which in turn will comprise of 2024*2048 blocks i.e. 2072576 blocks. Bigger block size are better for databases.But there is a catch ( a file consume will consume the block size in kb whatever its size like 1 kb will consume 2 kb in swap of block size 2024 kb so its not recommended for home/small office) so use small size(512) for home but large(>1024) for servers.It is the minimum amount of file system that can be created.. ( There's a calculator under applications part of gnome if you are some obscure amount like 57mb use it)

Then Type this:
dd if=/dev/zero of=/swapfilename bs=2024 count=2072576


Now this:
mkswap /swapfilename


Now to activate:
swapon /swapfilename

It will activate for this session only so to be able to boot with swap again at the end of all file systems type this:
/swapfilename swap swap defaults 0 0

After booting or in the current session type this:

free

Now if you have more than one hard disk there's a cool way to optimize performance:

Create separate swap partition ( not file) in each hard disk and see your swap performance increase like raid 0 parallel.