Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I try to rearrange the expression to make it more clear:
A = B + C = G + H G = B - E - F H = C + E + F
It seems that:

Mem: 1034332 983572 50760 0 149028 530132
shows "buffers" and "cached" as part of "used" memory.

But -/+ buffers/cache: 304412 729920
shows "buffers" and "cached" as part of "free" memory

The -/+ buffers/cache line shows how much memory is used and free from the perspective of the applications.
--- from http://gentoo-wiki.com/FAQ_Linux_Memory_Management#The_difference_between_buffers_and_cache

And I do a test on my box, it shows that when the "free" memory is going to be exhausted, the kernel will take back all the "buffers" memory, but still left some "cached"memory. Following is the output by "free -m -s 1" when I increasingly created threads to consume the memory:

total used free shared buffers cac +hed Mem: 7973 68 7904 0 8 + 27 -/+ buffers/cache: 33 7939 Swap: 2047 0 2047 total used free shared buffers cac +hed Mem: 7973 106 7866 0 8 + 27 -/+ buffers/cache: 71 7902 Swap: 2047 0 2047
total used free shared buffers cac +hed Mem: 7973 112 7860 0 8 + 27 -/+ buffers/cache: 77 7896 Swap: 2047 0 2047 ... ... total used free shared buffers cac +hed Mem: 7973 7750 222 0 8 + 27 -/+ buffers/cache: 7714 258 Swap: 2047 0 2047 total used free shared buffers cac +hed Mem: 7973 7752 220 0 8 + 27 -/+ buffers/cache: 7716 256 Swap: 2047 0 2047 total used free shared buffers cac +hed Mem: 7973 7834 138 0 8 + 27 -/+ buffers/cache: 7798 174 Swap: 2047 0 2047 total used free shared buffers cac +hed Mem: 7973 7932 40 0 7 + 22 -/+ buffers/cache: 7903 69 Swap: 2047 0 2047 total used free shared buffers cac +hed Mem: 7973 7930 42 0 0 + 11 -/+ buffers/cache: 7917 55 Swap: 2047 2 2045 total used free shared buffers cac +hed Mem: 7973 7931 41 0 0 + 3 -/+ buffers/cache: 7927 45 Swap: 2047 131 1915 total used free shared buffers cac +hed Mem: 7973 7925 47 0 0 + 4 -/+ buffers/cache: 7920 52 Swap: 2047 144 1903 total used free shared buffers cac +hed Mem: 7973 7925 47 0 0 + 4 -/+ buffers/cache: 7920 53 Swap: 2047 144 1903 total used free shared buffers cac +hed Mem: 7973 7925 47 0 0 + 4 -/+ buffers/cache: 7920 53 Swap: 2047 144 1903

In reply to Re^2: [OT]What is "buffers" and "cached" memory in Linux system box? by sunshine_august
in thread [OT]What is "buffers" and "cached" memory in Linux system box? by sunshine_august

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (9)
    As of 2014-07-24 21:33 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (167 votes), past polls