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?

  • 2
    $\begingroup$ This seems to be a matter of systems engineering, rather than computer science. In general, it's not possible to say that one computer is faster than another: it will depend on what the computer is to be used for. $\endgroup$ – David Richerby Aug 24 '15 at 15:44

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.

| cite | improve this answer | |
  • $\begingroup$ I'm not following this answer. How can it depend? How can the 4-core 1.3GHz CPU possibly be faster than the 2-core 2.6GHz? Even if there was zero overhead for scheduling, communication, etc., at best the 4-core CPU would be equal to the 2-core CPU, but not faster -- and in practice there will always be some overhead, so it'll always be slower. $\endgroup$ – D.W. Aug 24 '15 at 16:39
  • $\begingroup$ @MarkBooth, great observation! Write an answer of your own? $\endgroup$ – D.W. Aug 24 '15 at 16:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.