|
1
beginner
0
intermediate
0
advanced
|
|||
|
||||
|
As far as physical threads are concerned, there can only be as many threads as there are total number of cores for all CPUs in the machine. e.g if you have dual processor each with 4 cores, then the optimal number of threads is 8. Any more would cause context switching between threads and hurt performance. However this is only optimal if all your threads are busy doing cpu intensive work. Most of the times this is not the case as threads are waiting for some I/O device to respond, waiting for database results, waiting for results from remote process or service etc. So to answer the question, you should design your application in such a way that there are as many threads actually working (cpu) as there are number of cores at any given time (this excludes idle threads waiting for I/O etc).
|
|||
|
||||