libpersist, a C++ library, allows storing and loading of entire objects across executions. It also provides for object relocation between threads in a NUMA (non-uniform memory access) parallel processing environment.
libpersist was written for use in simulations, where software objects often correspond to simulated objects that are connected to or contained within others. During the build phase, the objects are instantiated, then stored to disk. In the operation phase, the objects are reloaded. The objects are usually built once, and operated many times with variations in inputs or parameters. There is usually no high throughput requirements during the build phase of a simulator. High throughput, however, becomes the most important issue in actual simulation runs.
The core idea is that objects stored to disk as POD are re-constructed as objects. This re-construction is aided by three id-based reference/handler template classes. They replace POPs (plain old pointers) for embedding objects in other objects. Together with supporting template functions, these reference classes relieve the user from the drudgery of explicitly coding for object management for every relevant object.
In a NUMA environment, threads can be made to execute on specified processors and allocate memory from specified memory blocks. This means objects should be relocated to the thread that will execute their member functions. Relocation is a special case of persistence, requiring re-construction after the POD has been moved in memory. After all objects have been relocated to their target memories, all references to the objects must be swizzled (their ids resolved to their addresses), so that they can be de-referenced efficiently like POPs.
libpersist does assume the use of threads, which share a common virtual address space, so that POPs are valid in all threads. It provides an in-memory object manager which keeps a hash table of object id to address translations. This means all objects are accessible in all threads. libpersist does not impose any access restriction. But users can impose their own.
The use of NUMA and threads is NOT part of libpersist. But example derived classes and programs, included as part of the documentation, demonstrate the use of libpersist in NUMA threads.
- Provides for the base class Object to be a virtual base for multiple inheritances.
- Provides for full reconstruction when an object is first loaded as a less than fully derived class, via overriding the static method Object::fullyReconstruct in an appropriate intermediate derived class.