Single file with controls to simulate multiple independent files.
Original Publication Date: 1999-Oct-01
Included in the Prior Art Database: 2003-Jun-19
The processing of sales in a retail store includes the transmission of sales data from the terminals to a central server. If the server is offline or unavailable, the data must be stored locally at the terminal and re-transmitted at a later time. This behavior is called offline processing. We built a multi-terminal simulator tool that had to mimic this behavior (among other tasks, of course). In the simulator, each terminal was modeled by an independent execution thread. The problem was that if each thread opened its own file for storing and retrieving the offline data, the number of open files would exceed the limits of what can be handled efficiently by the operating system on the machine where the simulator was running. On the other hand, it was necessary that the simulated terminals should behave in the same manner as the actual terminals, at least from the server's point of view. A vector table was designed, that held terminal number, the length of record, and an offset of the record into a storage file. The terminal number was used as a index for the vector. An associated file was created that held the actual record data. There are numerous threads, outside of the Offline class, and each behaves exactly as if it had its own separate offline file. Using the vector and corresponding data storage file allow for unsuccessfully sent records to be saved and then resent later, in the order that they were generated, during a period of less system activity. The employed concept is not unique to an offline file, but is applicable to any multi-machine simulation where each simulated machine needs what appears to be access to its own private files. 1