Linux迷,Python粉
人生苦短,我用Python 新博客https://blog.pythonwood.com 问题小站https://qa.1r1g.com 智问智答https://qa.1r1g.cn
 
 

通过du(find) 与 cat 体现buffer与cache差异实验:

实验表明:

1 通常 buffer << cache

2 "文件系统"相关内容(inode等)缓存在buffer,"文件系统"无关的(即文件内容)缓存在cache

 

同:

目的:提高linux的IO效率 

属性:对程序是透明的 (everything is a file in linux)

IO层:缓存在内存的其他慢IO层的数据。 (IO : 网络 < 磁盘 < 内存 < cpu缓存)

异:

buffer's policy is first-in, first-out

cache's policy is Least Recently Used.

 

之前我简单以为:

buffer针对的是字符型设备,cache针对块设备。

经过今天学习后我理解的buffer与cache变成:

buffer通过管理(队列实现异步)优化IO速度,cache通过记忆(数据停留)优化IO速度。buffer理解成元素队列,cache理解成数据副本。

 
posted on 2015-02-04 15:09  月冷风和霜  阅读(577)  评论(0编辑  收藏  举报

智问智答 https://qa.1r1g.cn 问题小站 https://qa.1r1g.com