Double Buffer

Use a DoubleBuffer, i.e. two buffers, when generating revised datasets for an asynchronous processor. When the new data is complete and self consistent, redirect the asynchronous processor to the alternate buffer.

DoubleBuffer became popular with the early computer graphics systems, in which a display processor was synchronized with the electron beam refreshing the display. You could use double buffers to update the display without flicker. Raster graphics systems tend to have a more synchronous interface, since often the only operations are "display graphical object on window". But DoubleBuffer is still useful, since building an off-screen bit-map and then displaying it prevents the user from seeing the intermediate forms of a picture and makes the program seem faster. This is why it is used in HotDraw.

Use a CircularBuffer to send continuous streams of data to another processor.

Especially effective when used to implement DeferredUpdate.

This is a specialized form of WaitFreeSynchronization. The reader (the part of the display that feeds the frame buffer data to the electron beam) never waits for anything, unlike the ReadWriteLock.

Also see TripleBuffer, CircularBuffer, GraphicsPatterns.

CategoryGraphicsPattern CategoryPattern

View edit of September 7, 2009 or FindPage with title or text search