On Tue, Dec 22, 2015 at 04:04:55AM +0800, Tinker wrote:
> On 2015-12-22 03:32, Otto Moerbeek wrote:
> >On Tue, Dec 22, 2015 at 02:31:58AM +0800, Tinker wrote:
> >
> >>Hi, on my 4GB RAM machine, top says
> >>
> >>"Memory: Real: 1293M/3786M act/tot Free: 158M Cache: 2079M Swap:
> >>449M/10G"
> >>
> >>All the five first columns vary over time, in particular the first four.
> >>
> >>3786 + 158 = 3944 is fairly close to 4GB so I guess that's the amount of
> >>RAM
> >>that the BIOS (+HW drivers?) actually left usable, so that number makes
> >>sense.
> >
> >AFAIK:
> >
> >tot: memory allocated by kernel
> >act: memory recently accessed, subset of tot.
> >free: memory not allocated
> >tot + free: total memory available
> >cache: pages allocated to buffer (filesystem) cache
> >
> >all memory includes both kernel and memory used by processes.
>
> Interesting.
>
> Okay so mallocs could be a huge part of the "tot" then.
>
> Do you have any idea of the definition of "active" here?
>
> (As in what makes a given part of "tot" be declared "active" by the OS.)
>
> Also what special treatment may the OS give memory that is not "active",
> swap it to disk??
>
Don't know the details how/when pages are marked inactive, but the
general ideas is: inactive r/o pages may be reclaimed when pages are
needed, inactive (and dirty) r/w pages may be written to disk (for
buffers) or swap (other r/w pages) when pages are needed for other
things.
-Otto