Download presentation
Presentation is loading. Please wait.
1
Additional Examples CSE420/598, Fall 2008
2
Example 1 A program runs in 10 seconds on a computer “A” that has 400 MHz clock. It is desirable to design a faster computer “B” that could run the program in 6 seconds. The designer has determined that a substantial increase in the clock speed is possible, however it would cause computer “B” to require 1.2 times as many clock cycles as computer “A”. What should be the clock rate of computer “B”? CSE420/598, Fall 2008
3
Example 1 (Cont.) To get the clock rate of the faster computer, we use the same formula CSE420/598, Fall 2008
4
Example 2 – Processor Performance Equation
Suppose two implementations of same ISA: M/c A: clock cycle time = 1ns; CPI = 2.0 (for some program) M/c B: clock cycle time = 2ns; CPI = 1.2 (for same program) Which M/c is faster? CSE420/598, Fall 2008
5
Example 2 – Processor Performance Equation (Cont.)
Answer: Fact: each m/c executes same number of instructions N Number of processor clock cycles per M/c M/c A: N x 2.0 = 2N M/c B: N x 1.2 = 1.2N CPU time for each M/c M/c A: (2N)x 1 ns = 2N ns M/c B: (1.2N) x 2 ns = 2.4N ns (CPU Perf. A)/(CPU Perf. B) = (CPU time B)/(CPU time A) = (2.4N ns)/(2N ns) = 1.2 Conclusion: M/c A is 1.2 times faster than M/c B for this program. CSE420/598, Fall 2008
6
Example 3 - Comparing Code Segments
A compiler designer is trying to decide between two code sequences for a particular machine. The hardware designers have supplied the following facts: For a particular high-level language statement, the compiler writer is considering two code sequences that require the following instruction counts: Which code sequence executes the most instructions? Which will be faster? What is the CPI for each sequence? CSE420/598, Fall 2008
7
Example 3 - Comparing Code Segments (Cont.)
Which code sequence executes the most instructions? Which will be faster? What is the CPI for each sequence? Answer: Sequence 1: executes = 5 instructions Sequence 2: executes = 6 instructions CSE420/598, Fall 2008
8
Example 3 - Comparing Code Segments (Cont.)
Using the formula: Sequence 1: CPU clock cycles = (2 1) + (1 2) + (2 3) = 10 cycles Sequence 2: CPU clock cycles = (4 1) + (1 2) + (1 3) = 9 cycles Therefore Sequence 2 is faster although it executes more instructions Using the formula: Sequence 1: CPI = 10/5 = 2 Sequence 2: CPI = 9/6 = 1.5 Since Sequence 2 takes fewer overall clock cycles but has more instructions it must have a lower CPI CSE420/598, Fall 2008
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.