Are there any benefits to limiting the number of concurrent threads doing a given task to equal the number of processors on the host system? Or better to simply trust libraries such as .NET’s ThreadPool to do the right thing … even if there are 25 different concurrent threads happening at any one given moment?
Are there any benefits to limiting the number of concurrent threads doing a given
Share
Most threads are not CPU bound, they end up waiting on IO or other events. If you look at your system now, I imagine you have 100’s (if not 1000’s) of threads executing with no problems. By that measure, you’re probably best just leaving the .NET thread pool to do the right thing!
However, if the threads were all CPU bound (e.g. something like ray tracing) then it would be a good idea to limit the number of threads to the number of cores, otherwise chances are that context switching will begin to hurt performance.