vmstat显示的buffer和cache的区别

  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.

猜你喜欢

转载自netcome.iteye.com/blog/754548