Idiot-maker

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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.

posted on 2008-12-01 11:43  NickyYe  阅读(571)  评论(0编辑  收藏  举报