Trying to understand double buffers

I'm having some trouble understanding double buffers. We have to write one for an assignment.

What I'm having trouble with is understanding the point of them. From what I've read the situation is somewhat analogous to filling a bucket of water from a tap and then putting another bucket under the tap (the second buffer) when the first is full so the first can be carried off to fill the paddling pool (or whatever) without having downtime (the tap being off).

Am I missing something by thinking that that setup is only any use if multithreading is also used? Without multithreading, the processor can only do one task at a time, so even with a second bucket (buffer) under the tap, the processor will still only deal with each process in turn - the implication of the water analogy is that two processes are happening at once; the filling of the second bucket, and the processing of the first. On a single threaded system surly only one of these actions can happen at once?

What am I missing?

Cheers, Benjamin
 
caesius said:
Am I missing something by thinking that that setup is only any use if multithreading is also used? Without multithreading, the processor can only do one task at a time, so even with a second bucket (buffer) under the tap, the processor will still only deal with each process in turn - the implication of the water analogy is that two processes are happening at once; the filling of the second bucket, and the processing of the first. On a single threaded system surly only one of these actions can happen at once?

What am I missing?

DMA

http://en.wikipedia.org/wiki/Direct_memory_access
 
Double buffering is mostly important in on the fly graphics rendering where your process is just feeding display device(that has high rate of refresh) with frames to display and when you need to render/draw new frame into buffer you have to push second buffer so you do not have an empty frame displayed while you are using time to render.
 
Back
Top