Buffer – Is Ping Pong Buffer the Same as Double Buffering?

buffer

In ping pong buffer we have two buffers, when one is being written by upstream component, the other is being read by the downstream component. When writing into one buffer is completed, the downstream component will switch to reading that as the other buffer is filled by the upstream component. This appears similar to how double buffering works.

Are ping-pong buffer and double buffer, two terms for the same thing?

Best Answer

No, they are not the same. Both are 'double buffering' in that they involve more than one buffer. However, ping-pong is a specific type, and the phrase 'double buffering' is usually (though not always) reserved for the not ping-pong type.

In ping-pong buffering, there are two buffers, either of which can be used for output. While one provides output, the other can be filled asynchronously. The buffers are then switched over when required. The essence of ping-pong buffering is that the output goes back and forth between the two buffers, just like a ping-pong ball goes back and forth, between the halves of the table.

Typically ping-pong buffering is used for video memory, especially when the memory is shared with the system. We have a large amount of information, and already have I/O addressing support for a simple and rapid switch of address spaces.

In double buffering, there is a first buffer that always receives the input, then a second buffer dedicated to driving the output, and a signal to transfer from one to the other.

Examples of double buffering are found in the HC595 shift register, and the MAX534 quad DAC - for the ability to receive and store the programmed word without changing the actual output until later. We have a small amount of information, and easy to connect memory, aka registers.