Monday, February 14, 2011

Chapter 7 Research

Research the circular buffer. Define it and compare & contrast it to both a single and a doube buffer. Explain why the circular buffer might be advantageous in multimedia applications. Remember to cite your sources & include your name.

Blog on!

12 Comments:

Anonymous Anonymous said...

It is a permanently allocated buffer that has both a read and write position. If you use a single buffer, you may end up overwriting what the other process did not read yet, or the other process may have to catch up with you before you finish writing your current set of data.With two buffers, you can write to one buffer while the other process is still reading the other buffer.

Gregory Wagner

My source is my book.

10:02 AM  
Anonymous Anonymous said...

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).

http://c2.com/cgi/wiki?CircularBuffer

Rafael Riera

8:37 AM  
Anonymous Anonymous said...

Circular buffering uses a single fixed sized buffer as if it were connected end to end or as if it has no real end.
With a single buffer you may end up overwriting what the other process has not read yet or the the other process may "catch up" with you before you finish writing.
With a double buffer you can write to one buffer while reading with the other buffer.
It's good for use in multimedia in the producer-consumer problem. If the consumer (eg:soundcard) can't temporarily keep up with the producer (eg:audio generator)can overwrite the old data.

www.answers.com
www.wikianswers.com
www.wikipedia.com

Susan Cain

4:22 PM  
Blogger J said...

This comment has been removed by the author.

1:13 PM  
Anonymous Anonymous said...

(sorry if this posts twice, had some trouble posting)

A circular buffer acts as a single buffer of infinite size. A pointer is used to keep track of the current read and write positions in the buffer. When one pointer reaches the end of the buffer, if returns to the beginning of the buffer and continues to read (or write as the case may be).

In a traditional single buffer, there is a potential for conflict with both read and write operations need to be performed at the same time. This can be eliminated in a circular buffer by having the read operation clear the data from the buffer as it reads it and making sure the write operation only writes to already cleared blocks in the buffer.

A double buffer eliminates this conflict altogether by using separate buffers for reading and writing, but this sows down the system and increases overhead considerably as both reading and writing must be paused between operations to swap the buffers.

Both single and double buffer systems face the problem of limited space. This problem is nonexistent in a circular buffer as the looping of the pointers simulates infinite buffer space.

The biggest problem with a circular buffer arises when one operation is notably faster than the other. That is, if the write operation happens much faster than the read operation, the write pointer may catch up with the read pointer, thus threatening to overwrite data that has not yet been fully processed. This problem is easy to correct for in software by having the write operation check the status of each block it intends to write to prior to writing to it. If the block is non-empty, the write process pauses until the read process can catch up. Thus, at worst, the system will experience brief pauses while loading the buffer, but should never face and indefinite failure in this regard.

The link below describes a simple implementation of a circular buffer in Javascript:

http://www.zerozaku.com/viewtopic.php?f=57&t=6717

-Josh Tryon

1:16 PM  
Anonymous Anonymous said...

Single buffer: you read and write on the same buffer, can be messy if both reading and writing take place at the same time. Double buffer: you read one buffer and you write the other one. When both reading and writing are complete, the buffers are swapped. It solves the problem of simultaneous reading and writing but requires synchronization. A circular buffer is a data structure of a fixed size which operates as if its ends were connected together
A double buffer is basically a circular buffer of size 2 and a single buffer is basically a circular buffer of size 1.The advantages of a circular buffer is Very simple and robust. You need only the two pointers.

http://www.answers.com/topic/circular-buffer-1#ixzz1FJN7Pb4q

Shaleasa Osborne

8:36 PM  
Blogger Jason Ingram said...

a circular buffer acts as a single buffer of infinite size. A pointer is used to keep track of the current read and write positions in the buffer. When one pointer reaches the end of the buffer, if returns to the beginning of the buffer and continues to read (or write as the case may be). A double buffer eliminates this conflict altogether by using separate buffers for reading and writing, but this sows down the system and increases overhead considerably as both reading and writing must be paused between operations to swap the buffers.
The biggest problem with a circular buffer arises when one operation is notably faster than the other. That is, if the write operation happens much faster than the read operation, the write pointer may catch up with the read pointer, thus threatening to overwrite data that has not yet been fully processed. This problem is easy to correct for in software by having the write operation check the status of each block it intends to write to prior to writing to it. If the block is non-empty, the write process pauses until the read process can catch up. Thus, at worst, the system will experience brief pauses while loading the buffer, but should never face and indefinite failure in this regard.

9:18 AM  
Anonymous Anonymous said...

With single buffer you write to the same buffer, double buffer , you read from one buffer an write to the other. Circular buffer is a buffer with 2 pointers, one for read and one for write, when it reaches the end it wraps back around to the beginning giving it the name circular buffer..

http://wiki.answers.com/Q/What_is_difference_between_single_double_and_circular_buffer

Rob Jones

10:34 AM  
Anonymous Kenny Gaddy said...

Circular buffer is an area of memory or a dedicated hardware circuit that is used to store incoming data and writes new data starting at the beginning of the buffer when the buffer is filled.

A single buffer is where you read and write on the same buffer whereas to a double buffer is where you read one buffer and you write the other one. When both reading and writing are complete, the buffers are swapped.

10:00 AM  
Blogger Valerie Yonkey said...

A circular buffer is used to store data. It is a read and write hardware. It has two pointers, the read and the write, which means if something is writing to the buffer at the same time something is being read it won’t be interrupted. Once the buffer is full it starts back at the beginning and write over what has already been read.
The single buffer has the read and write capability but only has one pointer. So things can get messed up if something is trying to write while the buffer is being read.
The double buffer is just that. One buffer is written on and one is read. When done they are swapped.
A circular buffer would be advantageous in a multimedia situation because the old information can be overwritten.

answers.com
wikipedia.com

1:54 PM  
Blogger lourdjean said...

A 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. An example that could possibly use an overwriting circular buffer is with multimedia. If the buffer is used as the bounded buffer in the producer-consumer problem then it is probably desired for the producer (e.g., an audio generator) to overwrite old data if the consumer (e.g., the sound card) is unable to momentarily keep up. Another example is the digital waveguide synthesis method which uses circular buffers to efficiently simulate the sound of vibrating strings or wind instruments.

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

Lourdjean Go

10:01 AM  
Anonymous Anonymous said...

Circular buffers use a single, fixed buffer as if it were connected end-to-end. It is advantageous in multimedia situations because it can be used as the bounded buffer to overwrite old data if the consumer is unable to momentarily keep up.

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

Ben Ayers

1:43 PM  

Post a Comment

<< Home