Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 ?

share|improve this question

migrated from stackoverflow.com Jun 17 '10 at 19:19

This question came from our site for professional and enthusiast programmers.

5 Answers 5

up vote 9 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
Hey James, Very Good Link ! –  S.Man Jun 17 '10 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. –  Evan Plaice Jun 18 '10 at 6:52

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.

share|improve this answer

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

share|improve this answer

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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