TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: DENNIS LEE BIEBER
date: 2020-01-25 14:13:00
subject: Re: Question about ever g

On Sat, 25 Jan 2020 18:05:05 +0000, Pancho 
declaimed the following:

>Is writing a page to swap the same as evicting it from RAM? Naively I
>would have thought it would just mark the page as ready for eviction,
>i.e. eviction from RAM would only occur after some further kind of
>ageing process and/or more memory pressure.
>

 Swap is typically only used when an application is requesting more
memory than is physically available (that may not be the same as physically
installed -- if you have a 4GB address range, but only 2GB of RAM, then
only a 2GB subset of the space can be loaded at any time, the rest is
swapped out; the MMU is responsible for tracking what addresses are
loaded). If the system has cached pages it can free (especially pages that
are only read-mode, not written to) it is supposed to free those cache
pages and make them available to the application requesting memory. Dirty
cache pages will need to be written out -- but those typically belong to
some file, not swap.

 Note that on decent systems, shared libraries (which are normally
read-only code) shouldn't end up in swap -- the library file itself should
be mapped, so unused pages can just be freed; when that section of code is
required again, it can be loaded from the library file itself.

>Apologies if my terminology isn't quite correct, I did used to know the
>basics of virtual memory for VMS but that was some decades ago. I don't
>think I've ever read a good description of how linux (or unix) handles
>it. Can anyone recommend a good technical overview of the subject, if
>such a thing exists.
>

 Other than reading kernel sources? Maybe
https://opensource.com/article/18/9/swap-space-linux-systems as an
introduction. And a decade old...
https://www.linux.com/news/all-about-linux-swap-space/



--
 Wulfraed                 Dennis Lee Bieber         AF6VN
 wlfraed@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.