In: Computer Science
1). Assume that, for a program Pro, compiler A and B both generate 1.0E9 instructions (instruction count=1.0E9). CPI_A= 1 and CPI_B=2 The processor A has a clock cycle time of 1 ns. And the processor B has a clock cycle time 2 ns.
A).To execute the same program Pro, which processor is faster and by how much?
B). To improve the slower processor in problem 1a, what can you do? (list all possible solutions)
Solution:
(1)
Given,
=>Compiler A: instruction count = 1*10^9, CPI_A = 1, clock cycle time = 1 ns
=>Compiler B: instruction count = 1*10^9, CPI_B = 2, clock cycle time = 2 ns
(a)
Explanation:
Calculating execution time of compiler A:
=>Execution time = instruction count*CPI*clock cycle time
=>Execution time = 1*10^9*1*1 ns
=>Execution time = 1*10^9*1*10^-9 sec as 1 ns = 10^-9 sec
=>Execution time = 1 sec
Calculating execution time of compiler B:
=>Execution time = instruction count*CPI*clock cycle time
=>Execution time = 1*10^9*2*2 ns
=>Execution time = 4*10^9*1*10^-9 sec as 1 ns = 10^-9 sec
=>Execution time = 4 sec
=>As execution time of compiler A is lesser so compiler A is faster.
Calculating speed up:
=>Speed up = execution time of compiler B/execution time of compiler A
=>Speed up = 4 sec/1 sec
=>Speed up = 4
=>As speed up = 4 so compiler A is 4 times faster than compiler B.
(b)
Explanation:
=>Slower processor = compiler B
Listing possible ways to improve solution:
=>We know that execution time = instruction count*CPI*clock cycle time
(i) As CPI decreases execution time also decreases so by decreasing the CPI of compiler B we can speed up compiler B.
(ii) As clock cycle time decreases execution time so by decreasing clock cycle time of compiler B we can speed up compiler B.
I have explained each and every part with the help of statements attached to the answer above.