In
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, e ...
, buffer underrun or buffer underflow is a state occurring when a
buffer
Buffer may refer to:
Science
* Buffer gas, an inert or nonflammable gas
* Buffer solution, a solution used to prevent changes in pH
* Buffering agent, the weak acid or base in a buffer solution
* Lysis buffer, in cell biology
* Metal ion buffer
* ...
used for communicating between two devices or
processes is fed with
data
In the pursuit of knowledge, data (; ) is a collection of discrete values that convey information, describing quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted ...
at a lower speed than the data is being read from it. The term is distinct from
buffer overflow, a condition where a portion of memory forms a buffer of a fixed size yet is filled with more than that amount of data. This requires the program or device reading from the buffer to pause its processing while the buffer refills. This can cause undesired and sometimes serious side effects because the data being buffered is generally not suited to stop-start access of this kind.
In terms of
concurrent programming, a buffer underrun can be considered a form of
resource starvation
In computer science, resource starvation is a problem encountered in concurrent computing where a process is perpetually denied necessary resources to process its work. Starvation may be caused by errors in a scheduling or mutual exclusion algori ...
.
The terms buffer underrun and buffer underflow are also used for meaning buffer underwrite, a condition similar to buffer overflow, but where the program is tricked into writing before the beginning of the buffer, overriding potential data there, like
permission bits.
General causes and solutions
Buffer ''underruns'' are often the result of transitory issues involving the ''connection'' which is being buffered: either a connection between two processes, with others competing for
CPU
A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, and ...
time, or a physical link, with devices competing for
bandwidth.
The simplest guard against such problems is to increase the size of the buffer—if an incoming
data stream needs to be read at 1 bit per second, a buffer of 10 bits would allow the connection to be blocked for up to 10 seconds before failing, whereas one of 60 bits would allow a blockage of up to a minute. However, this requires more memory to be available to the process or device, which can be expensive. It assumes that the buffer starts full—requiring a potentially significant pause before the reading process begins—and that it will always remain full unless the connection is currently blocked. If the data does not, on average, arrive ''faster'' than it is needed, any blockages on the connection will be cumulative; "dropping" one bit every minute on a hypothetical connection with a 60-bit buffer would lead to a buffer underrun if the connection remained active for an hour. In real-time applications, a large buffer size also increases the latency between input and output, which is undesirable in low-latency applications such as video conferencing.
CD and DVD recording issues
Buffer underruns can cause serious problems during
CD/DVD burning, because once the writing is started, it cannot stop and resume flawlessly; thus the pause needed by the underrun can cause the data on the disc to become invalid. Since the buffer is generally being filled from a relatively slow source, such as a
hard disk
A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating platters coated with magnet ...
or another CD/DVD, a heavy CPU or memory load from other concurrent tasks can easily exhaust the capacity of a small buffer. Therefore, a technique called
buffer underrun protection was implemented by various individual CD/DVD writer vendors, under various
trademark
A trademark (also written trade mark or trade-mark) is a type of intellectual property consisting of a recognizable sign, design, or expression that identifies products or services from a particular source and distinguishes them from others ...
s, such as
Plextor
Plextor (styled PLEXTOR) ( zh, 浦科特; ja, プレクスター) is a Taiwanese (formerly Japanese) consumer electronics brand, best known for solid-state drives and optical disc drives.
Company
The brand name Plextor was used for all products ...
BurnProof,
Nero
Nero Claudius Caesar Augustus Germanicus ( ; born Lucius Domitius Ahenobarbus; 15 December AD 37 – 9 June AD 68), was the fifth Roman emperor and final emperor of the Julio-Claudian dynasty, reigning from AD 54 un ...
UltraBuffer,
Yamaha Yamaha may refer to:
* Yamaha Corporation, a Japanese company with a wide range of products and services, established in 1887. The company is the largest shareholder of Yamaha Motor Company (below).
** Yamaha Music Foundation, an organization estab ...
SafeBurn, JustLink, and Seamless Link. With this technique, the laser is indeed able to stop writing for any amount of time and resume when the buffer is full again. The gap between successive writes is extremely small.
Another way to protect against the problem, when using
rewritable media
Computer data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processing unit (CPU) of a compute ...
(
CD-RW,
DVD-RW,
DVD-RAM
DVD-RAM (DVD Random Access Memory) is a DVD-based disc specification presented in 1996 by the DVD Forum, which specifies rewritable DVD-RAM media and the appropriate DVD writers. DVD-RAM media have been used in computers as well as camcorders an ...
), is to use the
UDF file system, which organizes data in smaller "
packets", referenced by a single, updated address table, which can therefore be written in shorter bursts.
Multimedia playback
If the
framebuffer of the
graphics controller
A graphics card (also called a video card, display card, graphics adapter, VGA card/VGA, video adapter, display adapter, or mistakenly GPU) is an expansion card which generates a feed of output images to a display device, such as a computer moni ...
is not updated, the picture of the computer screen will appear to hang until the buffer receives new data. Many video player programs (e.g.
MPlayer) feature the ability to drop frames if the system is overloaded, intentionally allowing a buffer underrun to keep up the tempo.
The buffer in an
audio controller is a
ring buffer. If an underrun occurs and the audio controller is not stopped, it will either keep repeating the sound contained in the buffer, or output silence depending on the implementation. Such effect is commonly referred to as "machinegun" or
Max Headroom
Max Headroom is a fictional artificial intelligence (AI) character portrayed by actor Matt Frewer. Advertised as "the first computer-generated TV presenter", Max was known for his biting commentary on a variety of topical issues, arrogant wit, ...
stuttering effect. This happens if the
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
hangs during audio playback. An error handling routine (e.g.
blue screen of death) may eventually stop the audio controller.
Intentionally imitating this audio glitch during the creation of music or sound art, either by manually splicing audio or re-triggering samples, or by using plugins, is called the
Stutter edit
The stutter edit, or stutter effect, is the rhythmic repetition of small fragments of audio, occurring as the common 16th note repetition, but also as 64th notes and beyond, with layers of digital signal processing operations in a rhythmic fashion ...
.
References
{{DEFAULTSORT:Buffer Underrun
Data transmission