I have to search a large solution space (enumerating all Latin Squares of a specific order) for valid solutions. I'm trying out multi-threading (boost::thread). I split up the solution space in subspaces and investigate a particular subspace within a single thread. This works well, since there are no dependencies between the threads.
But now I want to save all valid solutions in a list. Would it be best to use a single list (shared data) and surround it with a mutex or should I create lists (local data) per thread and join the lists after the threads have finished?
There might be millions of valid solutions for higher orders. So the process would either involve a lot of mutex locks/unlocks or it would involve a large memory footprint per thread.
Thanks, Daniel Dekkers