memory management

Hello everyone, could someone tell me what does buff/cache represents from output of free command in Linux? My problem is that cache memory is supposed to be a very small but fast memory, it's in killobyte but the output from free command gives me around 1.5G buff/cache
  • post-author-pic
    Mike C
    10-28-2018

    This probably offers one of the best explanations of how Linux manages memory.  I refer management type folks to it often.


    https://www.linuxatemyram.com/


  • post-author-pic
    Michael M
    10-29-2018

    Hello,


    The buffer contains file metadata ( raw disk blocks ) for recently accessed files, this is normally a smaller and more quickly flushed area of memory. There was an update to the Kernel around 2.4 ish when buffer and cache were combined in the free command as the buffer was not something that was really imperative to monitor on its own. 
    Cache is actual file contents for files that have recently been accessed. Cacheing the files makes access faster and places less load on the disk subsystem. If a file changes in memory it is marked 'dirty' ( different than the on-disk copy ) and then it is written to disk and marked clean. 
    As indicated in the article that was linked, cache should not affect memory as files will be purged to make room when there is more memory demand. Less cache means more disk i/o and this is where the performance hit is encountered.  it is possible for the cache to be large if there is not a great deal of demand for memory. 

  • post-author-pic
    raha117
    10-30-2018

    Thank you Mike Cochran and Thank you Michael McClaren for your explination, you guys were really helpful. Appriciated!

Looking For Team Training?

Learn More