14.1k views
0 votes
We have a system to which we can instantaneously add and remove cores - adding more cores never leads to slowdown from things like false sharing, thread overhead, context switching, etc. When the program foo() is executed to completion with a single core in the system, it completes in 20 minutes. When foo() is run with a total of four cores in the system, it completes in 8 minutes.

If 100% of foo() was parallelized, with 4 cores it would take 20/45 minutes. Since it instead takes 8 minutes, what fraction of foo() was parallelized?

User Yoni
by
8.2k points

1 Answer

3 votes

Final answer:

The fraction of foo() that was parallelized is 60%.

Step-by-step explanation:

The fraction of foo() that was parallelized can be determined by comparing the time it took to complete foo() with a single core to the time it took with four cores.

Using the information provided, when foo() is executed with a single core, it takes 20 minutes.

When it is executed with four cores, it takes 8 minutes. This means that the parallelization speedup is :

20/8 = 2.5.

Therefore, the fraction of foo() that was parallelized is:

1 - (1/2.5)

= 0.6, or 60%.

User Rajinder
by
8.4k points