Tried to run program X using 8 threads and it was over in n minutes.
Tried to run same program using 50 threads and it was over in n*10 minutes.
Why does this happen and how can I get optimal number of threads I can use?
multithreading
Tried to run program X using 8 threads and it was over in n minutes.
Tried to run same program using 50 threads and it was over in n*10 minutes.
Why does this happen and how can I get optimal number of threads I can use?
Best Answer
This is a complicated question you're asking. Without knowing more about the nature of your threads it's difficult to say. Some things to consider when diagnosing system performance:
Is the process/thread
All of these three resources are finite and any one can limit the performance of a system. You need to look at which (might be 2 or 3 together) your particular situation is consuming.
You can use
ntop
andiostat
, andvmstat
to diagnose what's going on.