Buffer underrun

Last updated

In computing, buffer underrun or buffer underflow is a state occurring when a buffer used to communicate between two devices or processes is fed with data 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 being used as a buffer has a fixed size but 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.

Contents

In terms of concurrent programming, a buffer underrun can be considered a form of resource starvation.

The terms buffer underrun and buffer underflow are also used to mean 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. [1]

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 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 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 trademarks, such as Plextor BurnProof, Nero 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, DVD-RW, DVD-RAM), 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 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 stuttering effect. This happens if the operating system 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.

Related Research Articles

Computer data storage Storage of digital data readable by computers

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.

Bus (computing) System that transfers data between components within a computer

In computer architecture, a bus is a communication system that transfers data between components inside a computer, or between computers. This expression covers all related hardware components and software, including communication protocols.

FIFO (computing and electronics) Scheduling algorithm, the first piece of data inserted into a queue is processed first

In computing and in systems theory, FIFO an acronym for first in, first out is a method for organizing the manipulation of a data structure where the oldest (first) entry, or "head" of the queue, is processed first.

In computing, interrupt latency is the time that elapses from when an interrupt is generated to when the source of the interrupt is serviced. For many operating systems, devices are serviced as soon as the device's interrupt handler is executed. Interrupt latency may be affected by microprocessor design, interrupt controllers, interrupt masking, and the operating system's (OS) interrupt handling methods.

Microcontroller Small computer on a single integrated circuit

A microcontroller is a small computer on a single metal-oxide-semiconductor (MOS) integrated circuit (IC) chip. A microcontroller contains one or more CPUs along with memory and programmable input/output peripherals. Program memory in the form of ferroelectric RAM, NOR flash or OTP ROM is also often included on chip, as well as a small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications consisting of various discrete chips.

Original Chip Set

The Original Chip Set (OCS) is a chipset used in the earliest Commodore Amiga computers and defined the Amiga's graphics and sound capabilities. It was succeeded by the slightly improved Enhanced Chip Set (ECS) and greatly improved Advanced Graphics Architecture (AGA).

Direct memory access (DMA) is a feature of computer systems that allows certain hardware subsystems to access main system memory independently of the central processing unit (CPU).

Universal asynchronous receiver-transmitter Computer hardware device

A universal asynchronous receiver-transmitter is a computer hardware device for asynchronous serial communication in which the data format and transmission speeds are configurable. It sends data bits one by one, from the least significant to the most significant, framed by start and stop bits so that precise timing is handled by the communication channel. The electric signaling levels are handled by a driver circuit external to the UART. Two common signal levels are RS-232, a 12-volt system, and RS-485, a 5-volt system. Early teletypewriters used current loops.

PIC microcontrollers Programmable single-chip 16-bit microprocessor for computer

PIC is a family of microcontrollers made by Microchip Technology, derived from the PIC1650 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to Peripheral Interface Controller, and is currently expanded as Programmable Intelligent Computer. The first parts of the family were available in 1976; by 2013 the company had shipped more than twelve billion individual parts, used in a wide variety of embedded systems.

Network interface controller Hardware component that connects a computer to a network

A network interface controller is a computer hardware component that connects a computer to a computer network.

Optical disc drive Type of computer disk storage dive

In computing, an optical disc drive (ODD) is a disc drive that uses laser light or electromagnetic waves within or near the visible light spectrum as part of the process of reading or writing data to or from optical discs. Some drives can only read from certain discs, but recent drives can both read and record, also called burners or writers. Compact discs, DVDs, and Blu-ray discs are common types of optical media which can be read and recorded by such drives.

Integer overflow Event when the result of computer arithmetic requires more bits than the data type can represent

In computer programming, an integer overflow occurs when an arithmetic operation attempts to create a numeric value that is outside of the range that can be represented with a given number of digits – either higher than the maximum or lower than the minimum representable value.

Optical disc recording technologies List of technologies used to write to optical discs

Optical disc authoring requires a number of different optical disc recorder technologies working in tandem, from the optical disc media to the firmware to the control electronics of the optical disc drive.

Fully Buffered DIMM

Fully Buffered DIMM is a memory technology that can be used to increase reliability and density of memory systems. Unlike the parallel bus architecture of traditional DRAMs, an FB-DIMM has a serial interface between the memory controller and the advanced memory buffer (AMB). Conventionally, data lines from the memory controller have to be connected to data lines in every DRAM module, i.e. via multidrop buses. As the memory width increases together with the access speed, the signal degrades at the interface between the bus and the device. This limits the speed and memory density, so FB-DIMMs take a different approach to solve the problem.

The memory controller is a digital circuit that manages the flow of data going to and from the computer's main memory. A memory controller can be a separate chip or integrated into another chip, such as being placed on the same die or as an integral part of a microprocessor; in the latter case, it is usually called an integrated memory controller (IMC). A memory controller is sometimes also called a memory chip controller (MCC) or a memory controller unit (MCU).

General Instrument CP1600

The CP1600 is a 16-bit microprocessor created in a partnership between General Instrument and Honeywell in 1975. It was among the first single-chip 16-bit processors; only the Texas Instruments TMS9900 is close in introduction date.

Intel 8237

Intel 8237 is a direct memory access (DMA) controller, a part of the MCS 85 microprocessor family. It enables data transfer between memory and the I/O with reduced load on the system's main processor by providing the memory with control signals and memory address information during the DMA transfer.

This glossary of computer hardware terms is a list of definitions of terms and concepts related to computer hardware, i.e. the physical and structural components of computers, architectural issues, and peripheral devices.

This article describes the processor, memory, and other components of the 1996 Nintendo 64 home video game console.

PlayStation 2 technical specifications Overview of the technical specifications of the PlayStation 2

The PlayStation 2 technical specifications describe the various components of the PlayStation 2 (PS2) video game console.

References

  1. "CWE-124: Buffer Underwrite ('Buffer Underflow')". CWE.