First off, Hello Blogging World!
So I have been doing a high performance computing project and I have had to profile this massive C program on Ubuntu Lucid Lynx (10.04 LTS). This program uses lots of memory. In fact, loads! I found that with larger inputs, the program was using all the DDR3 memory (4GB DDR3) and even flowing into the swap partition. The resulting graph of performance increases, then drops on these massive inputs. Why is this? This is caused by the read/write speed of memory on a hard disk, which is far more slower than on built-in memory. This block of memory is called the swap partition. The solution to avoid this anomaly was to disable swap so that it used the fast DDR3 RAM memory in the system.
What is the Swap Partition and Swapping
First off, what is the swap partition? Well, when you first installed your linux distribution, you may have had the option (or it may have done it for you) to create a swap partition on your hard drive. This is essentially like virtual memory on Windows where your hard drive is used as DDR memory would be used but you are using memory on the hard drive.
So why do you need to do this? Simple, if you find that your on board memory is sufficient for all your needs, you need consistency with memory speed and speed is everything (all boxes ticked in my case) then disabling swap is a no-brainer!
However, if you are unsure how much memory you would use or if you're pushed for memory space (that is on the DDR memory as opposed to the hard disk drive memory) then it's probably best to leave this alone.
How to Disable the Swap Partition
Reading a method from this website will show you how to do it.
The first method is using Gparted - a nice GUI interface
The other is doing it from the terminal using swapon and swapoff commands - great for system administrators
Happy swapping!
Zboarda