Wednesday, September 7, 2011

7. Why is swap space important in Linux?

I already faced with a problem about shortage of random access memory when I ran my code.
In this case Swap space can help us to overcome this problem (perhaps!).

Here is what swap is and what its applications is:


Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.
Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache.
More Info can be found in this 'website'

No comments:

Post a Comment