LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-03-2011, 11:10 AM   #1
maxxx15
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, 11:22 AM   #2
vasile002
Member
 
Registered: Oct 2011
Posts: 51

Rep: Reputation: Disabled
You can get more info from here:
https://www.linux.com/news/software/...nux-swap-space
 
Old 11-03-2011, 12:26 PM   #3
Juako
Member
 
Registered: Mar 2010
Posts: 202

Rep: Reputation: 84
Another resource: http://simple.wikipedia.org/wiki/Virtual_memory

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 01:14 PM.
 
Old 11-03-2011, 01:11 PM   #4
gary185
Member
 
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.
 
  


Reply


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 12:54 PM
2 swap partitions librano Linux - Newbie 6 08-25-2004 01:55 PM
eight swap partitions? linuxtesting2 Linux - General 7 07-20-2004 06:15 AM
Swap partitions 2k. Linux - General 7 03-01-2004 05:59 PM
swap partitions chappy011 Linux - Newbie 2 03-18-2002 01:44 PM


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

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