Timeline for Why using more threads makes it slower than using less threads
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 28, 2013 at 8:23 | comment | added | DocSalvager | I would just add that, instead of spending a lot of time calculating the optimal number of threads, just code it so that can be changed easily. Any large merge like this will require numerous test runs (most with small subsets of your data) to perfect. Increase the number of threads until you see a big drop in performance or impact on other system activity is unacceptable. | |
| Jun 23, 2013 at 22:24 | comment | added | EightBitTony | Every problem can be described at many levels of complexity. I have offered an approximation of the problem, which I believe is useful to explain the basics. Of course it can be more refined, and more detailed, but the more detailed you make it, the less useful it is as an introduction to the issue. | |
| Jun 23, 2013 at 20:04 | comment | added | Bratchley | It would also be useful to bear in mind that threads still have their own type of context switching that goes on. Increasing the number of threads doesn't increase performance capacity (as you pointed out) but it also drains CPU time by giving the kernel more work to do. Basically, there are diminishing returns on threading and doing too much causes performance retrograde. | |
| Jun 23, 2013 at 19:13 | comment | added | Bananguin | Great example, +1. Bakuriu, its an example that illustrates the problem of a limited shared resource. It's explaining the problem, not how to find the optimal number of threads. | |
| Jun 23, 2013 at 18:34 | comment | added | Bakuriu | Your example is misleading. It would be better to say something like: "You have a corridor that you can fit four people down, side by side and it is used by you and other people for different tasks. There is a referee that decides who can go through the corridor. Then the most efficient number of people is bigger than 4 and less than some number, where your people start to queue[highly context dependent]." Usually having some threads more than the number of CPUs performs better than using exactly 4 threads. If you are the only one using the CPU, then 4 is the best number. | |
| Jun 23, 2013 at 17:25 | history | edited | EightBitTony | CC BY-SA 3.0 | added 1 characters in body |
| Jun 23, 2013 at 14:52 | history | answered | EightBitTony | CC BY-SA 3.0 |