On Fri, 4 Feb 2005, ajith kumar wrote:
we need swap space double that of ur RAM, so that one half of the Swap we can write,and from the other half we can read back to the RAm. Its just like swapping two variable values, we need a third temporary variable. Here we can veiw swap as made up of 2 variables of the size equivalent to that OF ur RAM.
This is nonsense. Swap is done a page at a time, so in order to move all data from swap to ram and all data from ram to swap, you would only need 1 "extra" free page.
There is no need for having double the amount of space.
The amount of swap used depends simply on how much of your program data does not fit in RAM, and on nothing else.
If you have 128MB RAM and your programs use 200MB of total memory, then you'll end up with 72MB of data in swap. If your programs frequently access data read-only, the data will stay in swap even when read back into memory, so a disk write can be skipped at the next swapout. This optimisation will further increase the amount of swap space used, but it reduces the amount of disk IO done.
How much swap space you need ?
About 2-3 times as much as your system usually has in use. This keeps fragmentation low and IO fast.
-- "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/