Quote:
Originally Posted by Armann
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.