COD Ch. 2 The Role of Performance

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 13

COD Ch.

2
The Role of Performance
Performance
 Performance is the key to understanding underlying motivation
for the hardware and its organization
 Measure, report, and summarize performance to enable users to
 make intelligent choices
 see through the marketing hype!

 Why is some hardware better than others for different programs?


 What factors of system performance are hardware related?
(e.g., do we need a new machine, or a new operating system?)
 How does the machine's instruction set affect performance?
What do we measure?
Define performance….
Airplane Passengers Range (mi) Speed (mph)

Boeing 737-100 101 630 598


Boeing 747 470 4150 610
BAC/Sud Concorde 132 4000 1350
Douglas DC-8-50 146 8720 544

 How much faster is the Concorde compared to the 747?


 How much bigger is the Boeing 747 than the Douglas DC-8?

 So which of these airplanes has the best performance?!


Computer Performance:
TIME, TIME, TIME!!!
 Response Time (elapsed time, latency):
 how long does it take for my job to run?
 how long does it take to execute (start to Individual user
finish) my job? concerns…

 how long must I wait for the database query?


 Throughput:
 how many jobs can the machine run at once?
Systems manager
 what is the average execution rate? concerns…
 how much work is getting done?

 If we upgrade a machine with a new processor what do we increase?


 If we add a new machine to the lab what do we increase?
Execution Time
 Elapsed Time
 counts everything (disk and memory accesses, waiting for I/O,
running other programs, etc.) from start to finish
 a useful number, but often not good for comparison purposes
elapsed time = CPU time + wait time (I/O, other programs, etc.)

 CPU time
 doesn't count waiting for I/O or time spent running other programs
 can be divided into user CPU time and system CPU time (OS calls)
CPU time = user CPU time + system CPU time
 elapsed time = user CPU time + system CPU time + wait time

 Our focus: user CPU time (CPU execution time or, simply,
execution time)
 time spent executing the lines of code that are in our program
Definition of Performance
 For some program running on machine X:

PerformanceX = 1 / Execution timeX

 X is n times faster than Y means:

PerformanceX / PerformanceY = n
Clock Cycles
 Instead of reporting execution time in seconds, we often use
cycles. In modern computers hardware events progress cycle by
cycle: in other words, each event, e.g., multiplication, addition,
etc., is a sequence of cycles
seconds cycles seconds
 
program program cycle
 Clock ticks indicate start and end of cycles:

cycle time
tick

tick

 cycle time = time between ticks = seconds per cycle


 clock rate (frequency) = cycles per second (1 Hz. = 1
cycle/sec, 1 MHz. = 106 cycles/sec)
1
 Example: A 200 Mhz. clock has a  10 9  5 nanoseconds
cycle time 200  10 6
Performance Equation I
seconds cycles seconds
 
program program cycle

equivalently

CPU execution time CPU clock cycles  Clock cycle time


=
for a program for a program

 So, to improve performance one can either:


 reduce the number of cycles for a program, or
 reduce the clock cycle time, or, equivalently,
 increase the clock rate
How many cycles are required
for a program?
 Could assume that # of cycles = # of instructions
2nd instruction
3rd instruction
1st instruction

4th
5th
6th
...
time

 This assumption is incorrect! Because:


 Different instructions take different amounts of time (cycles)
 Why…?
How many cycles are required
for a program?
time

 Multiplication takes more time than addition


 Floating point operations take longer than integer ones
 Accessing memory takes more time than accessing registers
 Important point: changing the cycle time often changes the
number of cycles required for various instructions.
Performance Equation II
CPU execution time Instruction count  average CPI  Clock cycle time
=
for a program for a program

 Derive the above equation from Performance Equation I


Amdahl's Law
 Execution Time After Improvement =
Execution Time Unaffected + ( Execution Time Affected / Rate of
Improvement )

Improved part of code


 Example:
 Suppose a program runs in 100 seconds on a machine, with
multiply responsible for 80 seconds of this time.
 How much do we have to improve the speed of multiplication if we want
the program to run 4 times faster?
 How about making it 5 times faster?

 Design Principle: Make the common case fast


Summary
 Performance is specific to a particular program
 total execution time is a consistent summary of performance
 For a given architecture performance increases come from:
 increases in clock rate (without adverse CPI affects)
 improvements in processor organization that lower CPI
 compiler enhancements that lower CPI and/or instruction count
 Pitfall: expecting improvement in one aspect of a machine’s
performance to affect the total performance
 You should not always believe everything you read! Read
carefully! See newspaper articles, e.g., Exercise 2.37!!

You might also like