linux - Linux中的缓冲区和高速缓存有什么区别?

对我来说,不清楚这两个 Linux 内存概念之间的区别是什么:buffercache。我已通读 this post在我看来,它们之间的区别在于到期政策:

  1. 缓冲区的策略是先进先出
  2. 缓存的策略是最近最少使用的。

我说的对吗?

特别是,我正在查看两个命令:freevmstat

james@utopia:~$ vmstat -S M
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
5  0      0    173     67    912    0    0    19    59   75 1087 24  4 71  1
james@utopia:~$ free -m
             total       used       free     shared    buffers     cached
Mem:          2007       1834        172          0         67        914
-/+ buffers/cache:        853       1153
Swap:         2859          0       2859

最佳答案

Buffers are associated with a specific block device, and cover caching of filesystem metadata as well as tracking in-flight pages. The cache only contains parked file data. That is, the buffers remember what's in directories, what file permissions are, and keep track of what memory is being written from or read to for a particular block device. The cache only contains the contents of the files themselves.

quote link

https://stackoverflow.com/questions/6345020/

相关文章:

linux - sed 中的环境变量替换

python - 为什么 Pycharm 的检查员提示 "d = {}"?

linux - 如何在 Ubuntu 上设置和运行 PhantomJS?

linux - 查找不属于特定用户的文件

python - 使用 dict 文字和 dict 构造函数之间有区别吗?

python - 在 Python 中,如何拆分字符串并保留分隔符?

python - 类型错误 : method() takes 1 positional argume

python - 如何获得 Pandas 系列的元素逻辑非?

c - 如何将文件指针 ( FILE* fp ) 转换为文件描述符 (int fd)?

linux - 如何将stderr和stdout重定向到脚本同一行中的不同文件?