I think it depends, if all your tasks are “processor related”, this will probably equal the number of processors on your computer. However, if your tasks are "IO related," you can start increasing the number.
When a CPU needs to switch from one thread to another (context switch), it has a cost, so if you use too many threads and the processor switches all the time, you decrease performance. On the other hand, if you restrict this parameter too much, and the operations are long operations with the "IO" binding, and the CPU is idle for a long time, waiting for the completion of these tasks ... you are not doing the most with your machine resources (and this is about than multithreading)
I think that it depends on each algorithm, as indicated in the @Amdahls law, and there is no main rule that you can follow, you will need to plan and configure it: D
Greetings.
source share