When designing my simulator, I have gotten stuck on 2 main design choices.
The simulator can be described as having X number of nodes (between 50 - 2000) that each need to independently do some processing during each time-step in their own thread. After they are all done processing, then the main thread needs to do some processing on the results. The main thread will then advance the time-step and this process will continuously loop until the simulation is over.
- How would the Nodes tell the main thread they are done without exiting if they are each in their own thread?
The nodes are stateful, so they must persist after each iteration. join() i believe only works if the thread is done executing, which would not work for me. Is there some mechanism where the nodes can notify the main thread and then the main thread can have them start another iteration?