After graduating, you are asked to become the lead computer designer at Hyper Co
ID: 666484 • Letter: A
Question
After graduating, you are asked to become the lead computer designer at Hyper Computers, Inc. Your study of usage of high-level language constructs suggests that procedure calls are one of the most expensive operations. You have invented a scheme that reduces the loads and stores normally associated with procedure calls and returns. The first thing you do is run some experiments with and without this optimization. Your experiments use the same state-of-art optimizing compiler that will be used with either version of the computer. These experiment reveal the following information:
a. The clock rate of the unoptimized version is 5% higher;
b. 30% of the instructions in the unoptimized version are loads or stores;
c. The optimized version executes 2/3 as many loads and stores as the unoptimized version. For all other instructions the dynamic execution counts are unchanged;
d. All instructions (including load and store) take one clock cycle.
Which is faster? Justify your decision quantitatively.
Note: please answer all 4 parts with steps, i'll give a positive feed back, thankyou.
Explanation / Answer
Formula to calculate Compiler Performance:
Execution Time (T):T =I* CPI *t
Here
T: CPU time (seconds/program) needed to execute a program.
I: Number of Instructions in a given program.
CPI: Cycle per Instruction.
t: Cycle time. t=1/f, f=clock rate.
UnOptimized Compiler:
Assume CPI: Cycle per Instruction=4 for load and store
and 2 for other instructions.
clock rate 5 % times higher.
So, t=1/5f
30% of the instructions in the unoptimized version are loads or stores;
NumOfLoadStoreIns=30
Other instructions=(100-30)=70
Execution time of unoptimized compiler:
T=(30 * 4 * 1/5f) + (70 * 2 * 1/5f) = 24/f+28/f =52/f = 52 /0.108= 4814.81481481 Seconds
Optimized Compiler:
Assume CPI: Cycle per Instruction=1 for all instructions.
So, t=1/f
The optimized version executes 2/3 as many loads and stores as the unoptimized version.
NumOfLoadStoreIns=30*2/3 = 20
Other Instructions= 70
Execution time of Optimized compiler:
T=(20* 1 * 1/f)+(70* 1* 1/f)=20/f+70/f=90/f = 90 / 0.0108=8333.33333333 seconds
From the results, we came to know that unoptimized version is faster according to the specification
provided in the problem .that is due to the increase in clock rate .
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.