In: Computer Science
Computer A has an overall CPI of 1.5 and can be run at a clock rate of 2.5GHz. Computer B has a CPI of 4 and can be run at a clock rate of 4GHz. We have a particular program we wish to run. When compiled for computer A, this program has exactly 100,000 instructions. How many instructions would the program need to have when compiled for Computer B, in order for the two computers to have exactly the same execution time for this program?
CPI (number of cycles per instructions) for computer A = 1.5
Clock rate for computer A= 2.5 GHz
Clock time for computer A = 1/clock rate for A = (1/2.5)ns
CPI (number of cycles per instructions) for computer B = 4
Clock rate for computer B= 4 GHz
Clock time for computer B = 1/clock rate for A = (1/4)ns
Execution time for any computer = number of instructions * number of cycles each instruction take * time required for 1 cycle
For computer A:-
number of instructions = 100,000 = 105
Execution time = number of instructions * number of cycles each instruction take * time required for 1 cycle
= 105 * 1.5 * (1/2.5) ns
=( 3/5)*105-9
= (3/5)*10-4 seconds
For computer B:-
Let Number of instructions here = x
Execution time = number of instructions * number of cycles each instruction take * time required for 1 cycle
= x * 4 * (1/4)ns
= x ns
Now,it is given that execution time in both computers are same.
So, x * 10-9 = (3/5)*10-4
=> x = (3/5) * 10-4+9
So, x = (3/5) * 105 = (3/5) * 10 * 104 = 6 * 104
required number of instructions in Computer B =6 * 104 = 60000