buffer 与cache 的区别

buffer 与cache 的区别

  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.

  更详细的解释参考:Difference Between Buffer and Cache

   对于共享内存(Shared memory),主要用于在UNIX 环境下不同进程之间共享数据,是进程间通信的一种方法,一般的应用程序不会申请使用共享内存,笔者也没有去验证共享内存对上面等式的影响。如果你有兴趣, 请参考:What is Shared Memory?

  cache 和 buffer的区别:

  Cache:高速缓 存,是位于CPU与主内存间的一种容量较小但速度很高的存储器。由于CPU的速度远高于主内存,CPU直接从内存中存取数据要等待一定时间周 期,Cache中保存着CPU刚用过或循环使用的一部分数据,当CPU再次使用该部分数据时可从Cache中直接调用,这样就减少了CPU的等待时间,提 高了系统的效率。Cache又分为一级Cache(L1 Cache)和二级Cache(L2 Cache),L1 Cache集成在CPU内部,L2 Cache早期一般是焊在主板上,现在也都集成在CPU内部,常见的容量有256KB或512KB L2 Cache。

  Buffer:缓冲区,一个用于存储速度不同步的设备或优先级不同的设备之间传输数据的区域。通过缓冲区,可以使进程之间的相互等待变少,从而使从速度慢的设备读入数据时,速度快的设备的操作进程不发生间断。

  Free中的buffer和cache:(它们都是占用内存):

  buffer : 作为buffer cache的内存,是块设备的读写缓冲区

  cache: 作为page cache的内存, 文件系统的cache

  如果 cache 的值很大,说明cache住的文件数很多。如果频繁访问到的文件都能被cache住,那么磁盘的读IO bi会非常小。

http://www.blurtit.com/q241857.html

A buffer is a contemporary collection of location where a huge amount of data is managed or disassembled. This may be basic for interaction with a set of collection device that needs huge blocks of information, or when data must be given in a many way than that in which it is made, or rarely considerable when less blocks are not sufficient. The advantage is here even if the buffered data are stored to the buffer in one time and get from the buffer once.
A cache, on the other side, thinks that the data will be get from the cache more one time than they are written on them.
Its aim is to less the accesses to the underlying stock.
Buffer is a programmable cache managed by the operating system in the main storage and is used to have the most necessary data from disk, so that they don't have to be gotten again from the memory. This feature is available by the operating system. While cache is in real a hardware that the CPU uses to reduced the effective memory access time.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值