swapping some space


I don’t know if some of you are linux users… But I’m going to post this anyway ;-).

As you probably know you can divide your harddrive is different partitions. Let’s say that you have 2 hard drive, and you divide this drive in 2 partitions. The computer will recognise this hard drive as 2 hard drives.

Linux has a special kind of partition, the swap partition. Each time you install a linux OS you need to create one. But actually, few people know what it is.

Typical about linux is that it divides the RAM memory into little, let’s call it blocks, they are called pages. Swapping means that the information of a certain page is copied to the defined ‘swap space’ on your hard drive.
The swap space combined with the actual memory available is the virtual memory.

But why is swapping needed. Well there are 2 main reasons. The first one is about the available RAM memory. Your computer needs more than it actually has (that sucks doesn’t it). So what happens is that the kernel (compare this with the digital supervisor of your operating system) of your linux OS copies the information of less used pages to the swap space so more memory is available for the currently used applications.

The second reason is that some applications need information in pages during their initual startup. After that this information should never be used again. This information can be swapped out so, again, more memory is available for other applications.

Important to know is that there is a difference in speed between your RAM and you HDD. So swapping can get very slow, specially when it happens a lot.

Defining how much swap space you actually need is quite… well.. vague. Here are some rules you can follow.
For a modern day linux installation you can best define twice as much swap space as the available amount of RAM. Like this a lot of swapping can happen and you will be able to run quite some applications at the same time. This goes for desktop installations. If you are installing as server it should be sufficient to define a swap space half the size of the RAM. I say SHOULD BE, it may prove different on your configuration. You will need to keep an eye out on the performance of your system.

Swaporama dude!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: