The included code and white paper provides details for the implementation of a thread-safe data structure that creates and manages multiple ordered lists as a single data structure. Lists within the structure are indexed starting at 0 and proceed up to one less than the number of lists created. A set of API functions to interact with the multi-list structure are defined as outlined in the data structure description. A problem to “rank” instances of integers within a multi-list structure is used to test the data structure implementation.
The parallel solution has been implemented using akkithreads – a C++ wrapper over the Pthreads library with additional features such as JobQueues (Static / Dynamic) and a ThreadPool implementation.
DISCLAIMER: This code is provided by the author as a submitted contest entry, and is intended for educational use only. The code is not guaranteed to solve all instances of the input data sets and may require modifications to work in your own specific environment.