I'm multithreading a data processing program that reads from a file and then performs computations before writing the results to another file. The program needs to do reprocessing for different input parameters and I want to put each instance of the reprocessing on its own thread. Each instance is computation intensive so the thread creation overhead pales in comparison.
I'm looking at using the C++11 thread library. I may be accessing the same file from 100 different threads. This seems silly to me and I have a gut feeling that there is a better way to do this.
I saw in the comments that a thread/work pool has been mentioned. Can somebody provide a link with an implementation example or just explain it to me? I have an 8 core machine and would prefer to keep all cores maximized. Completely open to suggestions since I'm trying to learn how to do this efficiently.