一、明确概念

    • A buffer is something that has yet to be "written" to disk. 
    • A cache is something that has been "read" from the disk and stored for later use.

也就是说buffer是用于存放要输出到disk(块设备)的数据的,而cache是存放从disk上读出的数据。

从应用场景上看:Buffer 更多的(场景)是减小写操作的冲击,而 Cache 主要用于减小读 I/O 的重复开销。

The terms "buffer" and "cache" tend to be used interchangeably,  note however they represent different things.

(1)A buffer is used traditionally as an intermediate temporary store for data between a fast and a slow entity.

As one party would have to wait for the other affecting performance, the buffer alleviates this by allowing entire

blocks of data to move at once rather then in small chunks. The data is written and read only once from the buffer.

Furthermore, the buffers are visible to at least one party which is aware of it.

(2)A cache on the other hand by definition is hidden and neither party is aware that caching occurs. It as well

improves performance but does that by allowing the same data to be read multiple times in a fast fashion.

A further explanation of the differences between two can be found here.

二、命令输出

             total       used       free     shared    buffers     cached
Mem: 498 154 343 0 23 65
-/+ buffers/cache: 65 433
Swap: 1023 0 1023

Men:total = Men:used + Men:free

已使用     -buffers/cache = Mem:used - Men:buffers - Men:cached  = 154-23-65 = 154-88 = 66  (1024byte = 1M )

还剩余     +buffers/cache = Men:free  + Men:buffers + Men:cached  = 343+23+65 = 343+88 = 431

参考

spring-cache

java.nio.buffer

美团:磁盘I/O那些事

最新文章

  1. 在Redhat上为.Net 项目构建基于Jenkins + Github + Mono 的持续集成环境
  2. 安装centos时候自动安装vm tool,导致无法继续安装centos的解决办法
  3. Eclipse里面代码上下文变量点击后不一起变色
  4. httpclient提交json参数
  5. Centos部署nagios+apache实现服务器监控
  6. bzoj1976
  7. C++: Command Line Processing
  8. [重磅] 让HTML5达到原生的体验 系列之中的一个 避免切页白屏
  9. BaseFragment的定义—所有Fragment的父类
  10. 基础算法-查找:线性索引查找(II)
  11. [HAOI2006]受欢迎的牛
  12. JDBC数据库操作
  13. 浏览器渲染原理笔记 --《How Browser Work》读后总结
  14. [MySQL] mysql的事务隔离和幻读和死锁问题
  15. Oracle 项目中 SQL 脚本更新方式
  16. HTML文件默认内容
  17. all any some
  18. 【AOP】spring 的AOP编程报错:[Xlint:invalidAbsoluteTypeName]error
  19. mysql数据库,如何进行数据目录的初始化操作
  20. Java高级架构师(一)第41节:Nginx的配置优化以及使用建议

热门文章

  1. python之版本管理
  2. javascript构造函数的理解
  3. 安装好Oracle和PLSQLDeveloper后,PLSQLDeveloper登录时没有可选数据库和连接为问题
  4. 解决eclipse偶尔无视breakpoint的行为
  5. linux学习笔记34--命令rcp和scp
  6. hbase练习题
  7. javascript中的函数作用域和声明提前
  8. Paxos发展、算法原理
  9. easyUI的column的field的颜色属性
  10. 从TensorFlow0.12升级到TensorFlow1.13