If a process could run as much cores as available, which CPU is faster, a 2-core 2.6GHz CPU or a 4-core 1.3GHz CPU?
closed as off-topic by David Richerby, Juho, jmite, cody, vonbrand Aug 24 '15 at 18:38
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not appear to be about computer science, within the scope defined in the help center." – David Richerby, Juho, jmite, cody, vonbrand
The answer is surprisingly: "it depends".
Taking into account factors below are arguments that it will always win, based on assumption these are perfectly sliced situations (we take processor X, cut it into 2 and the same one into 4 and compare them).
The answer is: 2 core with double speed is > 4 core.
Otherwise it might be other way due to caches, pipelines, and even ability to utilize core (as system threads are in at least one core). Situation is not symmetric. And algorithmically many tasks cannot be parallelised, so disregarding differences 2 cores are still better (because we will run in serial mode, so faster core is better).
There are several unknowns and we take Amdahl's law into equation: https://en.wikipedia.org/wiki/Amdahl%27s_law This gives time of parallelization gains / loses.
0) Scheduling operation - how threads are created.
1) What part is really parallel?
2) How much time is being spent on intercommunication?
3) Are computations trivially parallel? If yes, and processors are of same cache and pipeline (proportional per core as in model X), there is difference only between scheduling 2 and 4 threads. So 2 is slightly better than 4. If no, due to communication issue 2 cores runs always faster.
If now processors are different (pipelines, cache and other characteristics) this can be solved only per instance basis taking into account also program to be run.
For instance, if the problem is embarrassingly parallel and each CPU has the same cache, then the fact that the quad core has twice the total cache might be enough to push it's performance higher, especially if the per CPU working set were able to be contained within that cache on the quad core system, but pushed out to main memory on the dual core CPU.