Cache vs Buffer Both cache and buffer are temporary storage areas but they differ in many ways. The buffer is mainly found in ram and acts as an area where the CPU can store data temporarily, for example, data meant for other output devices mainly when the computer and the other devices have different speeds. This way the computer can perform other tasks. Cache, on the other hand, is a high-speed storage area that can be part of the main memory or some other separate storage area like a hard disk. These two methods of caching are referred to as memory caching and disk caching respectively.
缓存 vs 缓冲
Key difference: A cache transparently stores data so that future requests for that data can be served faster.There are two main types of caches, memory caching and disk caching. A buffer, on the other hand, temporarily stores data while the data is the process of moving from one place to another.i.e. the input device to the output device.
关键区别:缓存,是透明存储的数据用于将来请求时可以服务得更快速。主要有两种类型的缓存:内存缓存和磁盘缓存。缓冲,则是,临时存储的数据可以被处理程序从一个地方移到另外一个地方。例,从输入设备到输出设备。
两者均指临时存储区域,但在很多地方又不同。“缓冲”主要使用场景:当其它输出外设有不同的速度时,CPU可以临时存储数据到内存暂存,此时电脑就可以先执行其他任务。“缓存”,另一方面,是一个高速存储区域,可以是内存,也可以是硬盘。这两种方法各自指的是内存缓存和磁盘缓存。
To ensure the high speed, cache is made of static ram rather than dynamic ram used for the other part of the memory since this is slower. This area is used to store information that is accessed by almost all the programs when they are running, and this makes it faster rather than searching for this information from the disk each time a program is running as this would be much slower. The buffer is made up of ordinary ram running in the computer, and it keeps track of changes happening in a running program by temporarily storing them before the changes are finally saved in the disk, for example, with word processors where the task being written is first stored in the buffer, and the word processor later updates the file in the disk with the contents of the buffer.
为保证高速,“缓存”由静态内存构成而不是动态内存,因动态内存会稍慢。这块区域会被所有运行的程序所访问,因其不用每次都用较慢的搜索磁盘的方式寻找内容,所有会更快速些。“缓冲”一般由内存构成,其会一直跟踪程序最新的临时数据,直到保存到磁盘为止。例,字处理软件保存时首先将内存存在缓冲里,然后才会将缓存的数据保存到硬盘。
The buffer is mostly used for input/output processes, for example, in printing. When one sends the documents to be printed to the printer, the information is stored in a buffer, and the printer can then access this information at its own pace, and this frees the CPU to perform other tasks. A buffer is also used when burning information to compact disks where the data to be burned is first stored in the buffer from where it is then transferred to the disk during the burning process. Cache is mostly used during reading and writing processes to the main disk to make the process faster by making similar data used by different programs easily accessible.
“缓冲”一般用来输出/输出处理,例,打印服务,当发送文件给打印机时,文档先存在缓冲里,打印机可以访问这块区域,这样CPU也可以先去执行其它任务。缓冲也用在刻盘光盘的过程,所以待刻录数据先存在缓冲里,刻录时才传到光盘写入。“缓存”大多数用户在读/写进程操作磁盘时,这样不同进程可以容易的访问相同的保存在磁盘上的数据。
Cache can either be part of ram or the disk. When the main disk is used as a cache, the process is referred to as disk caching, and this also works as memory caching where the recently used data is stored in the disk cache. If a running program wants to access data from the disk, it first checks the disk cache and will only check the disk if the required data is not available in the disk cache. This makes the data access process much faster since accessing it from the disk is much slower. A buffer can only be part of ram.
“缓存”可以是部分内存或部分磁盘。当把磁盘当作缓存时,这是磁盘缓存;当把作内存最近使用的数据保存在磁盘缓存时,这是内存缓存。当一个程序想从磁盘访问数据时,首先检查磁盘缓存,如果磁盘缓存无效时,程序才检查磁盘(注意没有缓存两字),这样比从磁盘直接获取速度快很多。“缓冲”只能是内存的一部分。
Summary: 1.Cache is a high-speed storage area while a buffer is a normal storage area on ram for temporary storage. 2.Cache is made from static ram which is faster than the slower dynamic ram used for a buffer. 3.The buffer is mostly used for input/output processes while the cache is used during reading and writing processes from the disk. 4.Cache can also be a section of the disk while a buffer is only a section of the ram. 5.A buffer can be used in keyboards to edit typing mistakes while the cache cannot.
总结:
1.缓存是一块高速存储区域,而缓冲是内存的一部分用来存储临时数据;
2.缓存使用静态内存,比使用动态内存的缓冲更快(注:应该当两者均使用内存时);
3.缓冲一般用在输入/输出处理上,而缓存是读/写磁盘上;
4.缓存可以是部分存在硬盘上,而缓冲只能存在内存上;
5.缓冲可以用在键盘输入编辑上,而缓存不能(注:这也算:)?)
另外一篇讲解的也不错,可以参考下 http://www.differencebetween.info/difference-between-cache-and-buffer
》简单的翻译有错莫怪《