LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 05-23-2013, 10:30 AM   #16
Armann
Member
 
Registered: May 2013
Location: Iceland
Distribution: RHEL/CentOS
Posts: 32

Rep: Reputation: Disabled

Ahh thanks, missed that.
 
Old 05-23-2013, 12:22 PM   #17
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
Quote:
Originally Posted by Armann View Post
I'm currently reading Michael Jang's RHCSA/RHCE sixth edition.
Quote from the book.
"Linux moves infrequently used programs and data to swap space even if you have gigabytes of RAM."
Get a better book

Programs are generally not moved to swap.

Most of a program is typically mapped into the process's address space from the original file. It is paged in from the original file as needed. If memory is tight, program pages that have not been used recently are dropped from memory (not written to swap). When such pages are needed again, they are paged in again from the original file.

The common, but wrong, idea you quoted is the root of a lot of common misconceptions about swap space. Swap space is used almost exclusively for paging (to from disk) "anonymous" pages. If you have too little swap space or restrict its use with swappiness, that causes more total paging, because program content (and other non anonymous pages) are often paged many times for lack of the ability to page anonymous data few times.

Last edited by johnsfine; 05-23-2013 at 12:28 PM.
 
Old 05-23-2013, 06:21 PM   #18
Armann
Member
 
Registered: May 2013
Location: Iceland
Distribution: RHEL/CentOS
Posts: 32

Rep: Reputation: Disabled
Quote:
Originally Posted by johnsfine View Post
Get a better book

If memory is tight, program pages that have not been used recently are dropped from memory (not written to swap).
Hehe
So to use a link from earlier in this post, https://help.ubuntu.com/community/SwapFaq
"Swap space temporarily holds memory pages that are inactive."
You say not been used recently, I would assume you mean inactive as well ?
 
Old 05-23-2013, 06:38 PM   #19
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
The important point I was making is that swap space is not involved at all when dropping pages from memory when those pages were file mapped (which is the usual method for most program content).

Quote:
Originally Posted by Armann View Post
Hehe
So to use a link from earlier in this post, https://help.ubuntu.com/community/SwapFaq
"Swap space temporarily holds memory pages that are inactive."
You say not been used recently, I would assume you mean inactive as well ?

Which simplification you choose to describe the basis for selecting pages to drop, is a separate question. The reality is more complicated than the description. But "inactive" or "not used recently" are both reasonable as simple descriptions for a more complicated process.

By contrast I think "Swap space temporarily holds" is not a valid simple description for pages that never go to swap space.
 
Old 05-23-2013, 06:53 PM   #20
Armann
Member
 
Registered: May 2013
Location: Iceland
Distribution: RHEL/CentOS
Posts: 32

Rep: Reputation: Disabled
I understand, thanks.
 
  


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
swap file vs. swap partition verndog Ubuntu 16 07-09-2012 09:49 PM
swap file or swap partition? What is better? zemir Linux - Newbie 28 08-19-2011 10:15 PM
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 03:16 PM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 11:46 AM
Newbie Installing Debian3 on m68k w/250M Partition Needs help creating swap partition AppleMac Linux - Newbie 2 11-01-2002 09:45 AM


All times are GMT -5. The time now is 04:28 PM.

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