什么是缓冲区?什么是缓冲的读写? [英] What is buffer? What are buffered reads and writes?

查看:447
本文介绍了什么是缓冲区?什么是缓冲的读写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天很久以后,我听到了缓冲一词,想知道是否有人可以很好地概述缓冲以及它在当今世界中的重要性。

解决方案

缓冲区通常是内存的一部分,其中包含尚未完全提交给其预期设备的数据。在使用缓冲I / O的情况下,通常会有一个快设备和一个慢设备。这些设备本身不必具有不同的速度,但是它们之间的接口可能有所不同,或者生成或使用数据的时间可能比其他部分更耗时。



<想法是将生成的数据临时存储在缓冲区中,这样当较慢的设备尚未准备好处理它时,它就不会丢失。一旦设备准备就绪,另一个缓冲区可能会取代当前缓冲区的位置,而使用方设备将处理第一个缓冲区中的数据。



这样,速度较慢的设备以适度的速度接收数据,而不是原始数据源可以正常工作。


I heard the word buffer after a long time today and wondering if somebody can give a good overview of buffer and some examples of how it matters in today's world.

解决方案

A buffer is generally a portion of memory that contains data that has not yet been fully committed to its intended device. In the case of buffered I/O, generally there is a fast device and a slow device. The devices themselves need not have disparate speeds, but perhaps the interfaces between them differ or perhaps it is more time-consuming to either produce or consume the data than the other part is.

The idea is that you temporarily store the generated data in a buffer so that it is not lost when the slower device isn't ready to handle it. Once the device is ready, the another buffer may take the current buffer's place and the consuming device will process the data in the first buffer.

In this manner, the slower device receives the data at a moderated pace rather than the fire-hose that the original data source can be.

这篇关于什么是缓冲区?什么是缓冲的读写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆