---------------------------------------------------------- Permission is granted for
below article to forward, reprint, distribute, use for ezine, newsletter, website, offer as free bonus or part of a product for sale as long as no changes are made and
byline, copyright, and
resource box below is included. ----------------------------------------------------------Buffer Underrun and Overrun Scenarios
By Stephen Bucaro
Buffer underrun and buffer overrun are occurrences that can result in some very frustrating errors. This is not a "how-to" article about fixing buffer underrun and buffer overrun errors, but a basic description of what a buffer is, why we need buffers, and what causes buffer underrun and buffer overrun.
Buffer Underrun
The most common occurrence of buffer underrun is CD recorders. Let's imagine an example of a CD recording session. The computer has an ATA hard drive capable of transferring data at a rate of 8 MBps (Mega Bytes per second). The CD recorder has a recording rate of 8 MBps. Everything should work fine, right?
Note: The data transfer rates mentioned in this article do not apply to any specific device. They're just for purposes of discussion.
The 8 MBps specification for
hard drive is for "burst" mode. In other words, it can transfer data at a rate of 8 MBps for only a few seconds. Then
transfer rate drops much lower, and if
hard drive hasn't been maintained, for example it has not been defragmented recently,
transfer rate can drop even lower.
Whereas a hard drive can skip from cluster to cluster while reading and writing, a CD recorder must burn
data track in a continuous stream without stopping. The design of a CD recorder requires a "sustained" transfer rate.
When two devices that operate at different transfer rates must communicate, we can make them work together by placing a buffer between them. A buffer is a block of memory, like a bucket for bytes. When you start
CD recording session,
hard drive begins filling
buffer. When
buffer is almost full,
CD recorder begins drawing bytes out of
buffer.
If everything goes smoothly,
hard drive will be able to keep enough bytes in
buffer so that
speedy CD recorder won't empty
buffer. If
buffer runs dry,
CD recorder has no data to burn into
CD, so it stops. Buffer underrun error.
We can reduce
chances of buffer underrun by configuring a larger buffer. Then
hard drive will be able to put more bytes in
bucket before
CD recorder starts drawing them out. However, sometimes you can't increase
size of
buffer because
computer doesn't have a large amount of RAM installed. When
computer needs more RAM, it uses "virtual" RAM. That is, it allocates part of
hard disk and pretends like that's RAM. Now, even though you've increased
size of
buffer, you have caused
hard drive to work even slower.
Buffer Underrun and Overrun Scenarios
Buffer Overrun
The most common occurrence of buffer overrun is video recorders. Let's imagine an example of a video camera connected to a computer. The video camera records at a data rate of 168 MBps. The computer monitor is capable of displaying data at a rate of only 60 MBps. We have a big problem, right?