Algorithms said to employ a Ping-Pong scheme exist in different fields of software engineering. They are characterized by an alternation between two entities. In the examples described below, these entities are communication partners, network paths or file blocks.
Databases
In most database management systemsdurabledatabase transactions are supported through a log file. However, multiple writes to the same page of that file can produce a slim chance of data loss. Assuming for simplicity that the log file is organized in pages whose size matches the block size of its underlying medium, the following problem can occur: If the very last page of the log file is only partially filled with data and has to be written to permanent storage in this state, the very same page will have to be overwritten during the next write operation. If a crash happens during that later write operation, previously stored log data may be lost. The Ping-Pong scheme described in Transaction Processing eliminates this problem by alternately writing the contents of said last page to two different physical pages inside the log file. Once said logical log page is no longer the last page, it is written one last time to the regular physical position inside the log file. This scheme requires the usage of time stamps for each page in order to distinguish the most recent version of the logical last page one from its predecessor.
Networking
Internet
A functionality which lets a computer A find out whether a computer B is reachable and responding is built into the Internet Control Message Protocol. Through an "echo request" Computer A asks B to send back an "Echo response". These two messages are also sometimes called "ping" and "pong".
In Routing, a Ping-Pong scheme is a simple algorithm for distributing data packets across two paths. If you had two paths A and B, then the algorithm would randomly start with one of the paths and then switchback and forth between the two. If you were to get the next path from a function call, it would look like this in Python: defget_next_path: whileTrue: yield'A' yield'B'