Tuesday, February 26, 2008

Circular Buffer

Research over the Internet the concept of the circular buffer. Define it and compare and contrast it to single and double buffers. Explain why the circular buffer might be advantageous in multimedia apploications. Cite your sources and the dates your source information was published. Be sure to include your name.

12 Comments:

Anonymous Anonymous said...

A circular buffer is a memory allocation scheme where memory is reused (reclaimed) when an index, incremented modulo the buffer size, writes over a previously used location.

A circular buffer makes a bounded queue when separate indices are used for inserting and removing data. The queue can be safely shared between threads (or processors) without further synchronization so long as one processor enqueues data and the other dequeues it. (Also, modifications to the read/write pointers must be atomic, and this is a non-blocking queue--an error is returned when trying to write to a full queue or read from an empty queue).

Note that a circular buffer with n elements is usually used to implement a queue with n-1 elements--there is always one empty element in the buffer. Otherwise, it becomes difficult to distinguish between a full and empty queue--the read and write pointers would be identical in both cases.

6:25 AM  
Blogger Unknown said...

A circular buffer is a single circular fixed buffer as if it is connected from end to end and is used to buffer data streams. This is a useful technology because data is no longer having to be shuffled around and the circular buffer is only used to read and write not move data. A circular buffer is of great use when working with multimedia such as certain audio. This circular buffer would be great if trying to play vibrating strings or wind instruments because it does not require shifting of data therefore no stop is needed in the playing.

-Steven Walker
http://en.wikipedia.org/wiki/Circular_buffer

10:27 AM  
Anonymous Anonymous said...

Research over the Internet the concept of the circular buffer. Define it and compare and contrast it to single and double buffers. Explain why the circular buffer might be advantageous in multimedia applications. Cite your sources and the dates your source information was published. Be sure to include your name.

DEFINITION
According to http://www.techweb.com/encyclopedia/defineterm.jhtml?term=circular+buffer

A circular buffer is an area of memory or a dedicated hardware circuit that is used to store incoming data. When the buffer is filled, new data is written starting at the beginning of the buffer. Circular buffers are typically used to hold data written by one process and read by another. In such cases, separate read and write pointers are used that are not allowed to cross each other so that unread data cannot be overwritten by new data.

THE CONCEPT
According to http://www.codeproject.com/KB/recipes/circularbuffer.aspx Circular Buffers are use for data transfer between two processes. The Producer process places items into the Circular Buffer and the Consumer process removes them. The variable capacity of the Circular Buffer accommodates timing differences between the Producer and Consumer processes.

COMPARE AND CONTRAST

A circular buffer is use to transfer data between two processes but a double buffer is a technique use by device driver to minimize delay in I/O operation that use a buffer.

a circular would probably be best with a counter specifying the total number of entries in the queue so that you can skip over n/2 of these elements and remove the "middle" element
http://c2.com/cgi/wiki?CircularBuffer
http://en.wikipedia.org/wiki/Double_buffering
http://en.wikipedia.org/wiki/Circular_buffer#How_it_works

Daniel

9:40 AM  
Blogger Wilfredo said...

Circular Buffer is a memory location that is managed by four pointers parameter, the start, the end, and the step size of a memory location. The last parameter indicates the next sample. Is all done by addressing and updating only one memory address with new sample value. This is managed in hardware level by implementation to be done at the beginning with initial pointer.
Lets see what operations are implemented for a simple FIR Filter:
Obtain new sample from ADC;
Detect an interrupt and manage it;
Move sample to circular buffer – update las previous sample;
Update pointer for input sample;
Zero Accumulator register;
Loop through each of coefficients;
Fetch coefficients from other circular buffer;
Update pointer for coefficients;
Fetch sample from circular buffer;
Update pointer;
Multiply coefficient by sample;
Add product to accumulator;
Move output sample to output buffer;
Move output sample to DAC.

http://www.scienceprog.com/circular-buffers-in-dsp-processors/

10:58 AM  
Anonymous Anonymous said...

Circular Beuffer is defined as an area of memory or a dedicated hardware circuit that is used to store incoming data(pcmag.com). In a circular buffer, when the buffer is full, new data that comes in is written at the beginning of the buffer. The circular buffers are used to hold data that is written by one process and read by another. Unread data is not overwritten by any new data that comes in because there are separate read and write pointers that are not allowed to cross eachother.
-Circular buffering is different from single or double buffers because the circular buffer was made to hold data from one process(input) to be recieved and read by another(output) while in double buffers one buffer is being read into one buffer while the other data is being processed by the other buffer.

-David Del Castillo

Sources:
http://www.pcmag.com/encyclopedia_term/0,2542,t=circular+buffer&i=39701,00.asp
published 2008.
http://www.techweb.com/encyclopedia/defineterm.jhtml?term=doublebuffering
published 2008.

11:03 PM  
Anonymous Anonymous said...

Circular buffers are actually linear buffers which wrap their pointers/indices around modulo the buffer size so that the first position follows the last position.
They can be set up to allow or not allow overwriting of unread data, the latter in situations like storing audio or other sampled data where dropping a few bytes now and then would at worst reduce data quality and not impact meaning.
They have several advantages, the main ones being that they take a fixed amount of storage, reserved once, and that the data need not be moved as it is read, as it would be in a single buffer; the writer can merrily continue writing along until it comes to unread data, where it may or may not be stopped, depending on the application. It has the advantage over a double buffer that neither reader nor writer need switch buffers.
The buffer requires a very small amount of overhead which shows the status of the data rather than that of the reader and writer processes.
These buffers are frequently used when there are more than one reader process.
They are especially useful in matching up processes that operate at non-matching speeds.

Hinrichs, Robert. “Circular Buffer”. www.codeproject.com/KB/recipes/ circularbuffer.aspx . posted 02/09/11. retrieved 08/03/06. Note: The codeproject site has much good info including definitions, algorithms, and some downloadable code.

Joyce

1:45 AM  
Anonymous Anonymous said...

Circular Buffer is defined as an area of memory used to store a continuous stream of data by starting again at the beginning of the buffer after reaching the end. A circular buffer is usually written by one process and read by another. Separate read and write pointers are maintained. These are not allowed to pass each other otherwise either unread data would be overwritten or invalid data would be read.

http://foldoc.org/?circular+buffer

Circular Buffers are use for data transfer between two processes. The Producer process places items into the Circular Buffer and the Consumer process removes them. The variable capacity of the Circular Buffer accommodates timing differences between the Producer and Consumer processes.
The Circular Buffer can execute faster than than other queues that hold a variable amount of data since a fixed size block of memory is allocated just once from memory management and then reused (the Circular Buffer can be visualized as such but is actually a linear buffer with indices that wrap, modulo the buffer size, when the end of the buffer is reached).
http://www.codeproject.com/KB/recipes/circularbuffer.aspx

Lonnie

1:22 PM  
Anonymous Anonymous said...

A circular buffer is a data structure which has one fixed size buffer, set up as though the begging and end are connected.

A circular buffer does not need to shuffle it's elements when one of them is consumed. This is key difference between the circular and other buffers. So the circular buffer is more suited as a first-in-first out buffer, where the others would be best as Last-in-first-out.

http://en.wikipedia.org/wiki/Circular_buffer

Thomas Kelley

8:36 PM  
Anonymous Anonymous said...

Circular Buffer is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. This structure lends itself easily to buffering data streams.A key advantage of a circular buffer is that it has a static size and elements need not be shuffled around when a portion of the buffer is used.The "prized" attribute of a circular buffer is that it does not need to have its elements shuffled around when one is consumed. (If a non-circular buffer were used then it would be necessary to shift all elements when one is consumed.) In other words, the circular buffer is well suited as a FIFO buffer while a standard, non-circular buffer is well suited as a LIFO buffer. www.en.wikipedia.org/wiki/circular_buffer.com

9:48 AM  
Anonymous Anonymous said...

A key advantage of a circular buffer is that it has a static size and elements need not be shuffled around when a portion of the buffer is used. This means that only new data is written to the buffer and the computational cost is independent of the length of the buffer. this portion is word for word, the info was short and to the point and needed no summerization on my part.
http://en.wikipedia.org/wiki/Circular_buffer

Jessie

12:08 PM  
Anonymous Anonymous said...

A major advantage of a circular buffer is that it has a static size and elements doesn't need to be shuffled around when a small portion of the buffer is used. Meaning that only new data is written to the buffer and the computational cost has little to do with the length of the buffer.

Like, when implementing a Transmission Control Protocol stack the windows used to hold the data can be circular buffers. When the receiver acknowledges the receipt of a packet then the amount of data acknowledged is used to advance the start of the buffer. This allows the stack to restrict the amount of unacknown data by the transmitter.

The best attribute of a circular buffer is that it does not need to have its elements shuffled around when one is being used. If a non-circular buffer were used then it would be necessary to shift all elements when one is being used. In other words, the circular buffer is well suited as a FIFO buffer while a standard, non-circular buffer is well suited as a LIFO buffer.

Jerod Finney

http://en.wikipedia.org/wiki/Circular_buffer

8:55 AM  
Blogger Jeremiah said...

Concept of the Circular Buffer:
Essentially its a ring of data that has no real end, but when the buffer becomes full the buffer then begins overwritting data where it first started storing data.
Definition , Compare and Constrast:
A Circular Buffer is a is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. This structure lends itself easily to buffering data streams.

The Circular buffer is well suited as a FIFO buffer and the single and double would look more like a line on a roller-coaster because the elements would be shifted around
http://en.wikipedia.org/wiki/Circular_buffer

4:46 PM  

Post a Comment

<< Home