Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-03-2011, 12:10 PM   #1
LQ Newbie
Registered: Nov 2011
Posts: 14

Rep: Reputation: Disabled
SWAP partitions

Hiii everyone,
I am a newbie to linux..Can anyone explain me what are swap partitions??
Old 11-03-2011, 12:22 PM   #2
Registered: Oct 2011
Posts: 51

Rep: Reputation: Disabled
You can get more info from here:
Old 11-03-2011, 01:26 PM   #3
Registered: Mar 2010
Posts: 202

Rep: Reputation: 84
Another resource:

Put simply, swapping (the precise term is "paging") is a method used to optimize RAM. In a computer, RAM memory is usually a limited resource in regards to what users demand. Take for example a common combination of programs in a session: operating system + system services + graphical environment + browser with many tabs + office suite + instant messenger + media player. These alone would normally "eat up" almost, if not all available RAM in the system.

Operating systems get around this limitation by sparing space for "simulating" extra RAM. Because of this, "swap space" is frequently termed as "virtual memory". The extra space is spared usually in your next common place to store things, that is, your hard disk.

The simulation basically works by tracking (several ways exist to do this tracking) how your RAM is used. RAM that is currently "less used" is marked as such, and eventually gets copied to the reserved disk space, freeing that area of RAM for things that could need it more. Whenever the area that was copied to disk is needed again, it will be copied back to RAM, perhaps forcing the previous process to be applied to some other RAM area. This exactly is why the process is called "swapping".

This is all done transparently by the Memory Manager of an Operating System, a core component of the kernel. The programs running always see their virtual RAM as real RAM, and don't care if it's swapped or not.

This way you are allowed to use much more RAM than you really have, but at the cost of getting too much swapping if you abuse of it. In that case you'll see a lot of disk activity and the system will slow to a crawl (because obviously, reading and writing to hard disk is WAY much slower than RAM). To get back to normal, just close some programs and documents.

Last edited by Juako; 11-03-2011 at 02:14 PM.
Old 11-03-2011, 02:11 PM   #4
Registered: Jul 2011
Posts: 113

Rep: Reputation: Disabled
yea the processor has limited memory cache.
so it fetches the info it needs from the virtual memory system.
if the processor decides it wants to hold on to something
it sticks it in RAM memory.
the processor maintains page tables to keep track of the virtual to actual memory translations.
the processor will only load pages into physical RAM that are currently needed by it.
the kernel space pages are given a dedicated space in physical RAM.
everything else is virtual.
this mean that when a process starts up it's executable image is loaded only into virtual memory not physical memory.
A file containing it is opened and its contents are mapped into the processes virtual memory.
as the application runs it generated page faults that are resolved by using the processes memory map and reading the virtual memory from disk into physical RAM and making an entry in the page table.
the swap file comes in when there is not enough physical RAM and some needs to be freed AND the data in the loaded page has been changed from the original image. This is called dirty pages. these dirty pages need to be saved so they get written to the swap partition.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
About swap partitions reeper13 Linux - Newbie 3 09-20-2008 01:54 PM
2 swap partitions librano Linux - Newbie 6 08-25-2004 02:55 PM
eight swap partitions? linuxtesting2 Linux - General 7 07-20-2004 07:15 AM
Swap partitions 2k. Linux - General 7 03-01-2004 06:59 PM
swap partitions chappy011 Linux - Newbie 2 03-18-2002 02:44 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration