Practice Quiz
Exam pattern: 1 small (5-mark) + 2 big problems. Solve on paper first, then reveal. Use the Calculators to check your numbers.
Type A โ Small (5-mark)
A1smallCPU clock rate 2.5 GHz. (a) Cycle time? (b) Program needs 5ร10โน cycles โ execution time?
(a)
T=2.5ร1091โ =
0.4 ns.
(b) Time =
2.5ร1095ร109โ =
2 s.
A2small10โถ instructions, average CPI 3.5, 700 MHz machine. Execution time?
Cycles=106ร3.5=3.5ร106Time=700ร1063.5ร106โ 5 ms.
A3smallMix: 50% loads (CPI 5), 30% ALU (CPI 1), 20% branches (CPI 2). Average CPI?
0.5โ
5+0.3โ
1+0.2โ
2=2.5+0.3+0.4 =
3.2.
A4smallX runs a program in 8 s; Y in 12 s. How many times faster is X than Y?
TimeXโTimeYโโ=812โ =
1.5ร faster.
A5smallProgram runs 20 s; new compiler cuts IC to 0.7ร but raises CPI 1.2ร. New run time?
20ร0.7ร1.2 =
16.8 s.
Type B โ Big (multi-step)
B1bigProgram runs 12 s on a 3 GHz machine. A redesign runs it in 8 s but needs 1.4ร as many cycles. Required clock rate?
CyclesoldโCyclesnewโRateโ=12ร3ร109=36ร109=1.4ร36ร109=50.4ร109=850.4ร109โโ 6.3 GHz.
B2bigSame ISA. P: cycle 200 ps, CPI 2.5. Q: cycle 400 ps, CPI 1.0. Which is faster, by how much?
TimePโ=ICโ
2.5โ
200=500โ
ICTimeQโ=ICโ
1.0โ
400=400โ
IC Q is faster, by 500/400=1.25ร.B3bigCPI A/B/C = 1/2/4. Seq 1 = (A=5,B=2,C=1); Seq 2 = (A=2,B=2,C=3). Same machine โ which is faster, by how much, and each CPI?
Seq 1: IC = 8, cycles =
5โ
1+2โ
2+1โ
4=13, CPI = 1.625.
Seq 2: IC = 7, cycles =
2โ
1+2โ
2+3โ
4=18, CPI โ 2.57.
Seq 1 is faster by 18/13โ1.38ร.B4big(MIPS pitfall) 2 GHz, CPI A/B/C = 1/2/3. Comp 1 (billions): A=4,B=2,C=1. Comp 2: A=8,B=1,C=1. Compare by MIPS and by execution time.
Comp 1: IC =
7ร109, cycles =
11ร109, time = 5.5 s, MIPS โ 1273.
Comp 2: IC =
10ร109, cycles =
13ร109, time = 6.5 s, MIPS โ 1538.
By MIPS Comp 2 wins; by execution time Comp 1 wins. MIPS misleads.B5bigProgram runs 200 s; memory ops take 120 s. How much faster must memory be for (a) 2ร faster, (b) 3ร faster overall?
Unaffected = 80 s.
New=80+x120โ (a) target 100 s:
x120โ=20 โน x = 6.
(b) target 66.67 s < 80 s floor
โน impossible (max =
200/80=2.5ร).
B6big(Reverse Amdahl) Vector instructions made 10ร faster; program then runs 4ร faster overall. What fraction f was vector work?
(1โf)+10fโ=0.25โน1โ0.9f=0.25 fโ0.833 (83.3%).
B7bigProgram spends 40% of time on FP; FP sped up 8ร. Overall speedup?
0.6+80.4โ1โ=0.651โ =
โ 1.538ร.
Exam-day checklist โข Watch units (ps/ns/MHz/GHz). โข "Same ISA / same program"
โน IC cancels. โข Always compare by execution time. โข Amdahl:
New=Unaffected+rAffectedโ; if target < unaffected
โน impossible. โข Master equation
CPUย time=ICรCPIรclockย rate1โ solves almost everything.