|
|
Subscribe / Log in / New account

Optimizing Linux with cheap flash drives

Optimizing Linux with cheap flash drives

Posted Feb 22, 2011 10:22 UTC (Tue) by cladisch (✭ supporter ✭, #50193)
In reply to: Optimizing Linux with cheap flash drives by Tara_Li
Parent article: Optimizing Linux with cheap flash drives

> once a program allocates itself some RAM, it *SURE* doesn't seem to want to give it up.

A program's allocations tend to be too fragmented, so functions like free() usually do not even try to give the memory back to the OS.

> Of course, this is really hard to be sure of, because any long time linux user will tell you that the memory columns in ps don't really mean anything useful, and when you dig further - it's hard to be sure the *KERNEL* knows what memory belongs to who - although it does do a good job of cleaning up after the application crashes, so it knows *SOMETHING*.

The biggest problem are shared libraries; the kernel knows who uses them, but it's not clear how their memory should be counted. (Which process gets charged for that memory? And when it exits, does the memory usage of the other processes suddenly increase?)

> What was the hard drive doing thrashing, since there was no designated swap for memory to be pushed off to temporarily?

Normal data can get swapped out, if there is swap.
Code from executable files does not need to be saved to swap because it can be reloaded from the executable file. In other words, every executable file is a read-only swap file.


to post comments

Optimizing Linux with cheap flash drives

Posted Feb 25, 2011 21:39 UTC (Fri) by oak (guest, #2786) [Link]

> The biggest problem are shared libraries; the kernel knows who uses them, but it's not clear how their memory should be counted. (Which process gets charged for that memory?

Look at the PSS figures in /proc/PID/smaps file.

Nice tool for that could be e.g. smem: http://www.selenic.com/smem/

(You can just apt-get it and then do "smem --pie=name".)

> And when it exits, does the memory usage of the other processes suddenly increase?)

If you're looking at PSS figures, yes.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds