[mythtv-users] Playback problem -- random short pauses

Mark Lord mythtv at rtr.ca
Sun Apr 17 17:21:18 UTC 2011


On 11-04-17 01:06 PM, Mark Lord wrote:
> On 11-04-17 11:57 AM, Steven Adeff wrote:
>> what happens when the systems use all their physical RAM?
> 
> What happens when the systems use all their physical SWAP?
> Same thing, same reason.
> 
> If something is leaking memory badly enough for the system
> to require swap space, then it will leak badly enough to
> consume the swap space as well (most people don't configure
> very much swap).
> 
> If you've already got swap, then keep it.  It's harmless.
> 
> Just think about.. "conventional wisdom" says to always configure
> as much swap as you have RAM.  Which effectively doubles the
> amount of RAM.
> 
> Personally, I prefer to REALLY double the amount of RAM,
> and then not bother with swap.


A little more background might help people to make informed decisions
about this topic.

"Swap" space is used ONLY to temporarily hold memory that has
been *modified* by a running process, and only then when the
system is low on unused physical RAM.

"Swap" space is not used to hold code and/or unmodified data
from an application --> Linux can re-read that stuff from the
original program file, so there's no need to write it out
to swap space when freeing RAM.

When the system is low on RAM, with or without swap space,
Linux can free RAM by discarding unmodified pages from memory.
Things like idle programs, or idle parts of programs, large
data tables, unmodified file contents etc..

When things like that get discarded, and then are later needed again,
Linux will just re-read them from the file where they originally
were read from.  No big deal, and no need/involvement for swap space.

Swap usually only comes into the picture when a running process
has accumulated a ton of modified memory -- run time variables
and data structures.  Nearly always this stuff comes from "malloc()".

When the system needs more RAM for something, and discarding
unmodified pages is insufficient, then it will try to write out
modified memory to swap space so that those pages can then be
temporarily freed up for other uses.  This is and should be rare.

Cheers


More information about the mythtv-users mailing list