CIE AS & A Level Computer Science, section 3.1 (Computers and their components)
What a buffer is
A buffer is a temporary area of memory that holds data while it is being moved from one place to another. It is used where the devices involved work at different speeds or at different times.
Why buffers are needed
The processor works much faster than devices such as printers, keyboards and disks. Without a buffer, the processor would have to wait for the slow device.
With a buffer:
- The processor sends the data to the buffer quickly.
- The processor is free to do other tasks.
- The slower device takes the data from the buffer at its own speed.
Examples
- Printer buffer: a document is stored in a buffer so the processor can carry on while the printer prints slowly.
- Keyboard buffer: keystrokes are stored until the processor is ready to read them.
- Streaming buffer: a video player stores data ahead of the part being shown so that short network delays do not cause pauses.
- Disk buffer: data read from or written to disk is held in memory.
Buffer behaviour
A buffer works like a queue: data leaves in the order it arrived (first in, first out). If the buffer fills up, the faster device must wait. If it empties (as in streaming), playback pauses.
Common mistake: saying a buffer "speeds up" the slow device. It does not: it lets the fast device carry on with other work while the slow device catches up. Also, a buffer is temporary storage and is not the same as cache memory.
Exam tip: explain the speed difference between the two devices, then what the buffer does for each. Give a specific example (printer or streaming video).
Check yourself
What is a buffer?
A temporary area of memory that holds data being transferred between devices.
Why is a printer buffer useful?
The processor can send the document quickly and do other tasks while the slow printer prints from the buffer.
Give another example of where a buffer is used.
Keyboard input, video streaming or reading from a disk.