Further memory question [was: Clear the computer's memory?]

Kent Borg kentborg at borg.org
Thu Mar 30 16:49:48 UTC 2006


On Thu, Mar 30, 2006 at 05:01:38PM +0100, R Kimber wrote:
> Are you saying that it takes maybe 24 hours for the kernel to work out
> which memory it can use for buffers and whatever?  I assumed that it
> would do this straight away and just dynamically release memory as I
> start up apps.

Kind of.  On a cold boot all the memory starts out as available.  The
kernel needs to load, and that takes a fairly small but fixed amount
of memory, very little preallocation happens.  After that all the
memory left over is available.  As programs need memory the kernel
dishes out memory.  As programs need other resources the kernel spends
memory to provide them.  As programs do IO the kernel does buffering
and cacheing.  As programs need more memory the kernel might steal
from the cache or buffers, or it might dump some code pages from RAM
(and load them in from disk again when and if later needed).

It is a dynamic situation that has everything to do with how you use
your machine.  Fire up Open Office one day and the exact results will
be rather different from doing a kernel compile the next day.  Do
those in the oposite order and the results will be still different.

> Gkrellm

I don't know what its meaning of "free" is.  (I can't find it in
Synaptic.)

> There is always about 700MB 'free'. What make it ignore that part of
> memory, which presumably I am not using? Or is the kernel limited as
> to how much memory it can dynamically manage?

700MB?  How much RAM do you have in total?  700MB (nearly three
quarters of a gigabyte?) is a lot of memory to always be "free", no
matter what Gkrellm considers "free" to mean.  (Is this maybe unused
cache?)

Something like 7MB would be a more sensible amount of free memory that
is just sitting there even when circumstances are tight.  That won't
ever go to zero because when memory is needed and everything is in use
the kernel can free up memory from various sources--but it takes
~some~ working memory to do those operations.  If the kernel used
every last bit of RAM it could get painted into a corner where there
is memory that could easily be scared up if only there were some
scratch space available.  Put another way, it could get in sort of
grid lock where it can't move anything because everything is full.
There always needs to be some memory for moving things about.
Occasionally, when these things are being moved, I suppose there could
be effectively zero memory free, but at those moments the kernel is
rather busy with important work (managing memory to keep the system
alive) and it isn't wasting time chatting with you on how much memory
is where--nor giving any user tasks execution time.  By the time you
get a chance to look at the memory situation there is some slack
again.


-kb




More information about the ubuntu-users mailing list