vmstat显示的buffer和cache的区别

  • Post author:
  • Post category:其他

 

  Try the manual first.
  $ man vmstat

   …

   Memory

       swpd: the amount of virtual memory used (kB).

       free: the amount of idle memory (kB).

       buff: the amount of memory used as buffers (kB).

       [红帽子8.0的Man中没有这一行]

       cache: the amount of memory used as cache.

    …
 
  See what’s on my Red Hat Linux server.
  $ vmstat
   procs                      memory    swap          io     system         cpu

 r  b  w   swpd   free   buff  cache  si  so    bi    bo   in    cs  us  sy  id

 0  0  0      0 316488 159612 493916   0   0     0     6   22    23  13   2  14
 
Answers Googled:
  To answer your question, buffers are only used for file metadata (inodes, etc) and data from raw block devices. It’s accessed via block device and block number.

  Cache has file data blocks, and memory mapped information (i.e. files mapped with mmap() calls). It’s accessed primarily via inode number.

  So, the main difference would be scope, I guess. One’s more concerened with blocks on a device, the other with information in a file.
  Either buffer can flush to disk, however. The buffer to the device file and the cache through the file system layer to the block device.   
 
参考资料:
    or buy Chinese edition from 
china-pub.

 


版权声明:本文为iteye_2535原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。