memory usage
Jerry Feldman
gerry.feldman at compaq.com
Thu May 2 11:21:54 EDT 2002
Just adding a bit to what David said.
Unix systems buffer all I/O. The buffers are allocated by the kernel for
all system-wide I/O. So, when you write a file (to just about any device),
you are writing to a buffer. Note that these kernel buffers have nothing to
do with the C language stdio package. These buffers are used by device
drivers. The Unix sync(8) command will cause all buffers to be flushed.
Normally there is a daemon (bdflush or update) that will sync the disks
periodically. Essentially, the buffering and caching by the kernel is one
of the things that makes Unix (and Linux) systems faster than Windows
systems.
On 2 May 2002 at 10:55, David Kramer wrote:
> On Thu, 2 May 2002, Drew Taylor wrote:
>
> > I'm running a kernel 2.4.2-2 (stock from RH 7.1) and am wondering what is
> > the difference between buffers and cached memory? I added 128MB and was
> > surprised to see so little memory free, even knowing that Linux does
> > aggressive caching.
> >
> > [drew at nephi]$ cat /proc/meminfo
> > total: used: free: shared: buffers: cached:
> > Mem: 195735552 194052096 1683456 0 13651968 122585088
> > Swap: 205590528 290816 205299712
> > MemTotal: 191148 kB
> > MemFree: 1644 kB
> > MemShared: 0 kB
>
> Linux, as well as most versions of UNIX, take whatever memory they think
> the system can spare and use it for disk cache. It's not really "used" in
> that it is not allocated to a userspace program. Even though you only
> have 1644K real memory free, you can allocate much more than that, because
> as the system needs more memory it will take blocks of it out of service
> as disk cache and allocate it to the user.
>
> Because of this, it may be hard to come up with a definitive number of
> "free memory". AIX has a very wacky scheme that makes it virtualy
> impossible, but at least here under Linux you are told how much is being
> used for cache buffers.
>
> ----------------------------------------------------------------------------
> DDDD David Kramer david at thekramers.net http://thekramers.net
> DK KD
> DKK D You don't usually hear "hydraulics" and "simplicity"
> DK KD in the same sentence.
> DDDD Cathy Rogers, Junkyard Wars
>
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://www.blu.org/mailman/listinfo/discuss
--
Jerry Feldman
Portfolio Partner Engineering
508-467-4315 http://www.testdrive.compaq.com/linux/
Compaq Computer Corp.
200 Forest Street MRO1-3/F1
Marlboro, Ma. 01752
More information about the Discuss
mailing list