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