Re: Memory used - but where?



Linux tries to make the best use of the available memory as it is
available. It reserves a small amount of heap (the 300 meg you saw)
for Malloc() operations, but the rest is allocated to buffering the
disk drives and hard drives.

If your applications have need for more memory, Linux can flush some of
the cache and make that extra memory available to the applications as
needed.

The main reason for doing this is because the hard drive latency is the
biggest performance killer in a modern PC. The memory and backplane
can handle gigabytes/second, but the hard drive spins at rates between
4500 and 10,000 RPM due to the physics of the spinning drive (heat).
A typical 7200 RPM drive with an 8 Mb internal cache can deliver about
40 megabytes/second - if the operating system can request entire tracks
or cylinders at a time. If the operating system is going out to the
hard drive to flip between directory tracks and multiple application
tracks, and reading only 512 bytes per request, the performance can
really suffer often something as simple as an FTP file transfer can
slow to less than 2 megabytes/second.. By combining the hard drive
cache with the Linux buffer cache, the disk drive access performance
can come much closer to that 20-40 megabyte/second.

There have been attempts to further increase drive throughput, usually
by reading all of the cylinders at once, having multiple heads so that
you can read 2, 3, or even 4 heads and capture entire cylinders or
tracks in a single rotation (many CD and DVD drives still use this
appreach), but to really take advantage of these designs, the
information either needs to be organized and stored in large clusters,
or you need a really large drive cache so that you can pull down 2-8
megabytes in a single spin and throw away what you don't need. Linux
can also improve performance by using it's cache across multiple drives
- typically in a RAID 10 environment where partitions are striped
across multiple drives, and then mirrored. Linux can be used as a SAN
storage system, or it can be used with high performance SAN and NAS
storage systems.

If you need more refined control over your memory allocation, you can
either use virtual machines, or use ulimit to keep an application from
grabbing too much memory. If you need the extra memory, Linux will
provide it to you, but if you are not using it directly, Linux can make
good use of what you aren't using.

It is worth noting that most of the time, when an application is trying
to grab very large amounts of memory, it's usually because the
application is trying to do it's own memory management. In general
this is usually not a really good idea. The problem is that if an
application is caching the drive, then there can be conflicts and
memory thrashing between the drive cache and the application cache.
Some database applications bypass the Linux caching by requesting raw
or uncached partitions.

.



Relevant Pages

  • Re: Sysinstall automatic filesystem size generation.
    ... much safer with the cache _enabled_, on most drives except the most ... >>advocates, typically against Linux users with journalled fs, on web ... points, even on consumer-grade hardware. ...
    (freebsd-stable)
  • Re: Linux on all new iron
    ... I've upgraded and/or fixed it a few times since then: more memory ... There are limits on ... --- Full time Linux with a virtual machine ... drives work with Linux? ...
    (comp.os.linux.hardware)
  • Re: e450 *FULL* diag?
    ... I reloaded Linux and let it run. ... bank so I swapped the RAM around between Bank0 and Bank3. ... There are many options in SunVTS for memory testing. ... I'm still playing with how I want the drives arranged. ...
    (comp.sys.sun.hardware)
  • Re: How to determine Linux real CPUs vs hyperthreaded (ht) virtual CPUs?
    ... Note that the new 4GB-4GB memory split feature, ... in Red Hat Enterprise Linux 3, has not yet been incorporated in the Linux ... >>slightly more page fetchers and page cleaners than hard drives. ...
    (comp.os.linux.setup)
  • Re: linux memory
    ... > oracle support also. ... My question is related to memory ... > usage of linux. ... > buffer) Why does linux incrase the cache size too much and than ...
    (comp.os.linux)