The number of cores that minimize the execution time of the program is __________.
View worked solution
Answer: 3
To find the number of cores that minimizes the execution time, we can model the execution time as a function of the number of cores, .
1. Analyze the Baseline Execution Time
The baseline execution time on a single core () is .
- Parallelizable portion: of
- Sequential portion: of
2. Formulate the Execution Time for Cores
When running on a multicore system with cores ():
- The sequential portion still takes .
- The parallelizable portion is divided equally among the cores, taking .
- There are additional cores, each contributing an overhead of . Thus, the total overhead is .
The total execution time is given by:
3. Minimize the Execution Time
To find the value of that minimizes , we can differentiate with respect to and set it to zero:
Since the second derivative for , this point represents a local and global minimum.
4. Verification for Integer Values
Let us evaluate for nearby integer values of to confirm:
- For :
- For :
- For :
- For :
The execution time is minimized when the number of cores is 3.
Free practice · Your answers on this page are not saved.
