3 ms·
Quite frankly, Im surprised the reason behind this isnt common knowledge, at least among us geeks. The reason is hardware designers have hit a wall, they cant
by petke 11y ago
Quite frankly, Im surprised the reason behind this isnt common knowledge, at least among us geeks.
The reason is hardware designers have hit a wall, they cant make single threaded applications run any faster.
So your brand new gaming PC is no faster at running single core applications than your 10 year old computer is. You can copy over any single core application from your new PC to your old one, and it will run just as fast.
What your new computer has is more cores though. Ideally you want linear scaling. That is if you have 2 cores your program should run twice as fast, and if you have 256 it should run 256 times as fast. This kind of scaling is almost impossible to achieve. Most programs don't scale beyond a certain number of cores.
Your multithreaded program might run a bit faster if you throw an extra core at it, but very quickly throwing more cores at it doesn't make a difference. It might even get slower. You have all those extra cores idle, or worse they are busy waiting.
Most programs dont scale well to many cores because any synchronization between cores kill scalability. If you have ANY sequential steps in your application that will put a limit on scalability.
As an example say you have 4 cores. You have a main loop on one core, it posts expensive work to the other (3) cores. And when they are done, you collect all the results and use them somehow. This final step is sequential and it kills your scaling. Your application wont run 4 times faster. And it probably wont run any faster if you throw 16 cores at it. This is because that one core is synchronizing with all the other cores. So those other cores do a lot of waiting around. And any sequential steps in that one core becomes the bottleneck, as those other cores will all end up waiting for it.
This message is already too long. So long story short. Single threaded programs are no faster on new computers, and most multi threaded programs dont scale well to many cores. Its a huge wasted opportunity to let cores be idle or underutilized. We have to fundamentally change our programming style and tools to take make use of all available cores.
More info by Herb Sutter:
http://www.gotw.ca/publications/concurrency-ddj.htm http://www.gotw.ca/publications/concurrency-ddj.htm
http://herbsutter.com/welcome-to-the-jungle/ http://herbsutter.com/welcome-to-the-jungle/
- Denzel 11y agoThe phenomenon you're describing is exhibited best by Amdahl's Law: https://en.wikipedia.org/wiki/Amdahl%27s_law https://en.wikipedia.org/wiki/Amdahl%27s_law.
- nisa 11y ago> Single threaded programs are no faster on new computers, and most multi threaded programs dont scale well to many cores. There is also some progress - http://www.cpubenchmark.net/singleThread.html http://www.cpubenchmark.net/singleThread.html I'm writing this on a Core2Duo E6750 that has a single thread score of 1000 - most new CPUs are at least twice as fast. Also Instructions per cycle going up. It's really a hard problem. You can't just spawn threads and put mutexes in front of you data structures. This is terribly slow, even slower than single core without locking for some tasks. We need better lockless data structures that minimize synchronisation.
- rasz_pl 11y agoThe best example to bring this idea home is $70(~$40 used) Pentium G3258 on ~$30 motherboard. It gets single thread score of 2400, so almost top of the chart. In single core games like World of Tanks (python ...) there is no differenve between this bottom of the barrel CPU and i7 *overclocked to 4.2
- Tepix 11y agoThe E6750 is a 2.66Ghz CPU that was introduced in Q3 2007. That means that single core performance went up only 8% per year on average. Compared to the improvements we made in the decades before that, that's really poor. I have a i7-2600k (quad core 3.4Ghz, 95W TDP, HT) that was introduced in 2011. Five years later, it still is not significantly slower than recent CPUs by Intel unless they take advantage of new CPU features. It sold for around 250€ back then. Today, for 250€ you can buy an i5-6600k (quad core 3.5Ghz, 91W TDP, no HT). The only big improvement in the i5-6600k is the GPU (which I don't use).