In
computing, a 'buffer' is a region of
memory used to temporarily hold data while it is being moved from one place to another. Typically, the data is stored in a buffer as it is retrieved from an input device (such as a keyboard) or just before it is sent to an output device (such as a printer). However, a buffer may be used when moving data between
processes within a computer. This is comparable to
buffers in telecommunication. Buffers can be implemented in either hardware or software, but the vast majority of buffers are implemented in software. Buffers are typically used when there is a difference between the rate at which data is received and the rate at which it can be processed, or in the case that these rates are variable, for example in a printer
spooler.
Applications
Buffers are often used in conjunction with I/O to hardware, such as disk drives, sending or receiving data to or from a network, or playing sound on a speaker. A line to a rollercoaster in an amusement park shares many similarities. People who ride the coaster come in at an unknown and often variable pace, but the roller coaster will be able to load people in bursts (as a coaster arrives and is loaded). The line to the ride acts as a buffer: a temporary space where those wishing to ride wait until the ride is available. Buffers are usually used in a
FIFO (first in, first out) method, outputting data in the order it came in.
Types
★
Circular buffers
==Comparison of Buffers and
Cache==
Buffers are allocated by various processes to use as input queues, etc. Data is read in from one source, and then written to another, as the sources are ready to receive or send data.
A
Cache is a storage of frequently requested I/O. Instead of computing or reading the data from its original source, which may be time intensive, a cache stores that data in a location that can be accessed faster, such as
RAM, then reads it back from the faster source the next time it is requested. For example, if multiple processes are accessing the same files, the contents of those files will be cached (or stored) in RAM to improve performance (as RAM can be read faster than hard drives).
See also
★
Buffer (telecommunication)
★
Buffer overflow
★
Buffer underrun
★
Circular buffer
★
Cache
★
Streaming media
★
Frame buffer for use in graphical display
★
Double buffering and
Triple buffering for techniques mainly in graphics
★
Pixel buffer,
Color buffer,
Depth buffer,
Stencil buffer,
Accumulation buffer for different parts of image information