Two processors, P1 and P2, support the same instruction set. The instructions in
ID: 3746690 • Letter: T
Question
Two processors, P1 and P2, support the same instruction set. The instructions in the instruction set can be divided into four classes, i.e., Classes A, B, C, and D. The specifications of these two processors are listed as follows:
For a given program, it contains 30% Class A instructions, 20% Class B instructions, 20% Class C instructions, 30% Class D instructions.
(A) What is the overall CPI for execution this program on each processor?
(B) If this program contains 3 × 10^9 instructions, how many seconds does each processor need to take to execute this program?
Processor Frequency (GHz) CPI of each Instruction Class Class A Class B Class C Class D P1 2 1 2 3 4 P2 3 2 2 4 3Explanation / Answer
A)
For Processor 1 :-
Given Number of Class A instructions is = NA = 30% ,
CPI of class A instructions is = CA = 1.
Number of Class B instructions is = NB = 20% ,
CPI of class B instructions is = CB = 2.
Number of Class C instructions is = NC = 20% ,
CPI of class C instructions is = CC = 3.
Number of Class D instructions is = ND = 30% .
CPI of class D instructions is = CD = 4.
Overall CPI for execution is = NA x CA + NB x CB + NC x CC + ND x CD
= 30% x 1 + 20% x 2 + 20% x 3 + 30% x 4
= 0.3 + 0.4 + 0.6 + 1.2
= 2.5
Hence Overall CPI of Processor 1 for execution is = 2.5.
For Processor 2 :-
Given Number of Class A instructions is = NA = 30% ,
CPI of class A instructions is = CA = 2.
Number of Class B instructions is = NB = 20% ,
CPI of class B instructions is = CB = 2.
Number of Class C instructions is = NC = 20% ,
CPI of class C instructions is = CC = 4.
Number of Class D instructions is = ND = 30% .
CPI of class D instructions is = CD = 3.
Overall CPI for execution is = NA x CA + NB x CB + NC x CC + ND x CD
= 30% x 2 + 20% x 2 + 20% x 4 + 30% x 3
= 0.6 + 0.4 + 0.8 + 0.9
= 2.7
Hence Overall CPI of Processor 2 for execution is = 2.7.
B)
For Processor 1 :-
Here CPI of Processor 1 for execution is = 2.5.
Hence for 1 instruction we need 2.5 clocks.
Given frequency of Processor 1 is = 2 GHz implies
Clock period is = 1 / frequency = 1 / 2 GHz = 0.5 ns.
Time take to exexute n instructions is = n x number of clocks x clock period.
Time take to exexute 3 × 109 instructions is = 3 × 109 x 2.5 x 0.5 ns
= 3 x 109 x 2.5 x 0.5 x 10-9 s
= 3 x 2.5 x 0.5 = 3.75 secs.
Hence Time take to exexute 3 × 109 instructions in Processor 1 is = 3.75 secs.
For Processor 2 :-
Here CPI of Processor 2 for execution is = 2.7.
Hence for 1 instruction we need 2.7 clocks.
Given frequency of Processor 2 is = 3 GHz implies
Clock period is = 1 / frequency = 1 / 3 GHz = 0.33 ns.
Time take to exexute n instructions is = n x number of clocks x clock period.
Time take to exexute 3 × 109 instructions is = 3 × 109 x 2.7 x 0.33 ns
= 3 x 109 x 2.7 x 0.33 x 10-9 s
= 3 x 2.7 x 0.33 = 2.7 secs.
Hence Time take to exexute 3 × 109 instructions in Processor 2 is = 2.7 secs.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.