I'm adding a plugin to an existing app which will create a thread for every core. The plugin is multi-threaded and can be called by any of the app threads at any time. The plugin is sifting through a large dataset using multiple threads and, based on what is found, performing a series of tasks. I am told that performance will benefit if these tasks can be performed in parallel, and i suspect that it is best for a thread to concentrate on a specific task type to avoid thrashing memory too much. So, assuming my approach is ok (if it isn't, pls let me know), my question is this:
Am i better off stashing the tasks in task-specific queues, then using parallel for or some other mechanism to process them after the dataset has been sifted and all tasks identified?
Or, alternatively, maintain a thread pool for each task type and submit the task as it is discovered to the appropriate pool.
Or, something else :>)
The machines in question have 8 x86 cores and there are 5 task types. Each task must fetch files from the OS and perform some calculations. Obviously mileage will vary based on task type, core performance, OS, etc. but i'm hoping there are some rules of thumb which might help without getting too deeply into premature optimization.