Buffer underrun
Encyclopedia
In computing
Computing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...

, buffer underrun or buffer underflow is a state occurring when a buffer
Buffer (computer science)
In computer science, a buffer is a region of a physical memory storage 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 or just before it is sent to an output device...

 used to communicate between two devices or processes
Process (computing)
In computing, a process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system , a process may be made up of multiple threads of execution that execute instructions concurrently.A computer program is a...

 is fed with data
Data
The term data refers to qualitative or quantitative attributes of a variable or set of variables. Data are typically the results of measurements and can be the basis of graphs, images, or observations of a set of variables. Data are often viewed as the lowest level of abstraction from which...

 at a lower speed than the data is being read from it. 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.

General causes and solutions

The term should not be confused with buffer overflow
Buffer overflow
In computer security and programming, a buffer overflow, or buffer overrun, is an anomaly where a program, while writing data to a buffer, overruns the buffer's boundary and overwrites adjacent memory. This is a special case of violation of memory safety....

, a condition where a portion of memory being used as a buffer has a fixed size but is filled with more than that amount of data. Whereas buffer overflows are usually the result of programming errors, and thus preventable, 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 time, or a physical link, with devices competing for bandwidth
Bandwidth (computing)
In computer networking and computer science, bandwidth, network bandwidth, data bandwidth, or digital bandwidth is a measure of available or consumed data communication resources expressed in bits/second or multiples of it .Note that in textbooks on wireless communications, modem data transmission,...

.

The simplest guard against such problems is to increase the size of the buffer—if an incoming data stream
Data stream
In telecommunications and computing, a data stream is a sequence of digitally encoded coherent signals used to transmit or receive information that is in the process of being transmitted....

 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
Hard disk
A hard disk drive is a non-volatile, random access digital magnetic data storage device. It features rotating rigid platters on a motor-driven spindle within a protective enclosure. Data is magnetically read from and written to the platter by read/write heads that float on a film of air above the...

 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
Trademark
A trademark, trade mark, or trade-mark is a distinctive sign or indicator used by an individual, business organization, or other legal entity to identify that the products or services to consumers with which the trademark appears originate from a unique source, and to distinguish its products or...

s, such as Plextor
Plextor
is a brand best known for its optical disc recorders. The brand name is used for all products manufactured by the Electronic Equipment Division and Printing Equipment Division of Shinano Kenshi. The brand was formerly known as TEXEL by which name it introduced its first CD-ROM optical disk drive in...

 BurnProof, Nero
Nero AG
Nero is a global computer software company headquartered in Karlsbad, Germany. It is perhaps most well-known for its burning software, Nero Burning ROM.-History:The company was founded as Ahead Software GmbH in 1995 by Richard Lesser....

 UltraBuffer, Yamaha 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 (CD-RW
CD-RW
A CD-RW is a rewritable optical disc. It was introduced in 1997, and was known as "CD-Writable" during development. It was preceded by the CD-MO, which was never commercially released....

, DVD-RW
DVD-RW
A DVD-RW disc is a rewritable optical disc with equal storage capacity to a DVD-R, typically 4.7 GB. The format was developed by Pioneer in November 1999 and has been approved by the DVD Forum. The smaller Mini DVD-RW holds 1.46 GB, with a diameter of 8 cm.The primary advantage of DVD-RW over...

, DVD-RAM
DVD-RAM
DVD-RAM is a 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 and personal video recorders since 1998.-Design:DVD-RAM is one of three competing...

), is to use the UDF
Universal Disk Format
Universal Disk Format is an implementation of the specification known as ISO/IEC 13346 and ECMA-167 and is an open vendor-neutral file system for computer data storage for a broad range of media. In practice, it has been most widely used for DVDs and newer optical disc formats, supplanting ISO 9660...

 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
Framebuffer
A framebuffer is a video output device that drives a video display from a memory buffer containing a complete frame of data.The information in the memory buffer typically consists of color values for every pixel on the screen...

 of the graphics controller 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
MPlayer
MPlayer is a free and open source media player. The program is available for all major operating systems, including Linux and other Unix-like systems, Microsoft Windows and Mac OS X. Versions for OS/2, Syllable, AmigaOS and MorphOS are also available. The Windows version works, with some minor...

) 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
Sound card
A sound card is an internal computer expansion card that facilitates the input and output of audio signals to and from a computer under control of computer programs. The term sound card is also applied to external audio interfaces that use software to generate sound, as opposed to using hardware...

 is a ring buffer. If an underrun occurs and the audio controller is not stopped, it will keep repeating the sound contained in the buffer, which may hold a quarter of a second. Such effect is commonly referred to as "machinegun". This happens if the operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 hangs during audio playback. An error handling routine (e.g. blue screen of death
Blue Screen of Death
To forse a BSOD Open regedit.exe,Then search: HKLM\SYSTEM\CurrentControlSet\services\i8042prt\ParametersThen make a new DWORD called "CrashOnCtrlScroll" And set the value to 1....

) may eventually stop the audio controller.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK