LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Order of memory usage in linux?? (https://www.linuxquestions.org/questions/linux-server-73/order-of-memory-usage-in-linux-731423/)

pgb205 06-08-2009 09:14 AM

Order of memory usage in linux??
 
I'm not sure I understand the order in which memory is being used under linuxOS. We have cached memory, free memory and used memory.
'free' is not used by anything, 'cached' is stuff that OS loads in hopes of speeding up access in the future and 'used' is what's actively used right now. Let's say a new application is now requesting memory. Will OS first try to allocate memory from free pool or will it first try to get some space from the cached memory pool. In the latter case will it have to swap the data from cached memory pool to disk first or is it simply removed without being saved.

thanks

david1941 06-08-2009 09:24 AM

You are forgetting about the buffers. Linux saves I/O in buffers to combine disk IO and it is available for use almost immediately. First the stale buffers are used, then free, and if more is needed, some of the cache is swapped to swap. (so I think, which may not be the case)

Dave

ilikejam 06-08-2009 10:41 AM

Have a look at the 'swappiness' value too. Might help clear up some things.

http://lwn.net/Articles/83588/

Dave


All times are GMT -5. The time now is 08:10 AM.