DPRSim is a multithreaded application. There is currently one mode of operation (each Catom has it's own thread) with the plan for another (one worker thread is passed around between Catoms). Each of the oracles also have their own thread. There is one oracle per CodeModule that is currently running in the simulator. For now this page will cover the first, existing threading model.

Currently, as a world file is loaded and the CatomSim data structures are created, a thread is also created and ties to that individual Catom. This allows the kernel to schedule these threads independantly of the Simulator. This provides realistic pseudorandom thread scheduling from the point of view of the Catom developer. All data structures are considered volitile until all of the Catoms have been created in the simulated world. Now the threads are allowed to run the following functions in this order:

00 CodeModule::startSimulation(); alone
01 CodeModule::Oracle(); alone
02 CodeModule::newTick(); Oracle() and endTick(); interleaved
   <--- Graphics can refresh an indefinite number of times here
03 CodeModule::Oracle(); alone
04 goto 02 until simulation over
05 CodeModule::Oracle(); alone
06 CodeModule::endSimulation(); alone
The main graphics thread will continue regardless of the paused/unpaused state of the simulator. This allows users to pause the simulation and reposition the camera before continuing.