4

If i replace a single-core processor with a dual-core processor, Will it increase the throughput by two times ? If No, why throughput does not get doubled ?

5 Answers 5

9

It definitely won't increase by a factor of two; that would be a perfectly efficient increase in throughput. That's not possible since there's always some overhead. How much benefit you get will depend on a few factors:

  • It may not increase at all if the OS or programs you're running on it aren't equipped to schedule processes on different cores.

  • It might only increase by a little if the tasks you're doing aren't very parallelizable (e.g. they depend heavily on I/O or other slow non-CPU operations).

  • It might increase by a good deal if the tasks are "embarrassingly parallel", e.g., long runs of identical floating-point computations or prime-number factorization.

  • It might make things worse if there's too much context-switching because of dependencies between the processes, or if you need to sync things across the processes.

5

See http://en.wikipedia.org/wiki/Amdahl%27s_law for a good description about why it won't double your throughput, and how to analyze what the improvement actually will be.

2
  • Hey James, Very Good Link ! Jun 17, 2010 at 19:26
  • @James +1 For learning something new. I've heard the 'law of diminishing returns' used to describe this issue but 'Amdahl's law' is new to me. Thanks for this. Jun 18, 2010 at 6:52
0

Your throughput will only be better, if your code is written to take advantage of two processors. Generally, you will need to make sure that your code uses 2 or more threads of execution to perform the job.

Only in some cases you will see performance actually doubled, as there is some book keeping needed in order to have multiple threads running.

0

Only for things that are CPU bound. Things that are memory bandwidth or I/O bound will probably not improve at all.

0

It depends on what kind of code you're running. If you're compute-bound and your code uses threads then you may see a 2x throughput improvement (at the same clock speed). If you are memory I/O bound or single-threaded then you may see no improvement at all (or even a deterioration in performance).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .