top or htop? Which one lies?
Chris Jones
christopher.rob.jones at cern.ch
Sun Nov 8 08:55:08 UTC 2009
On 7 Nov 2009, at 10:54pm, Mark Greenwood wrote:
> I hope someone on here can clear this up.
>
> According to top my RAM is as follows:
> 2060580k total, 1866728k used, (which seems to me to be a
> ridiculously enormous amount of RAM to run a bare desktop)
> According to htop (which I can't copy and paste)
> 269/2012MB (which seems to me to be a quite miraculously small
> amount of RAM to run a bare desktop)
>
> Which one lies? And why the mahoosive discrepancy?
Neither. The difference is almost certainly the file cache.
ram access is much faster that disk access, and your linux kernel
knows this, so will use any 'unused' ram as a cache of all recently
accessed files, just in case you need them again. This means most
linux system will, after some time of usage, use what might seem like
a surprising large amount of ram, even when you aren't actually
running any applications.
The confusion comes because some ways of monitoring memory usage
include the file cache, others don't, since the ram used for the file
cache is only used as long as it is not needed for any other usage. As
soon as it is needed it will be given back. For me, the clearest
utility is the command line 'free' command.
So, my bet is your system is using 269MB of ram for real data storage,
and the difference between this and 1867MB is the file cache...
Chris
More information about the kubuntu-users
mailing list