0% found this document useful (0 votes)
29 views20 pages

Chapter 01

Uploaded by

mostafayounis630
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views20 pages

Chapter 01

Uploaded by

mostafayounis630
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 20

COMPUTER ORGANIZATION AND DESIGN

5
Edition
th

The Hardware/Software Interface

Chapter 1
Computer Abstractions and
Technology
§1.6 Performance
Defining Performance
 Which airplane has the best performance?
Boeing 777 Boeing 777

Boeing 747 Boeing 747

BAC/ Sud BAC/ Sud


Concorde Concorde
Douglas Douglas DC-
DC-8-50 8-50

0 100 200 300 400 500 0 2000 4000 6000 8000 10000

Passenger Capacity Cruising Range (miles)

Boeing 777 Boeing 777

Boeing 747 Boeing 747

BAC/ Sud BAC/ Sud


Concorde Concorde
Douglas Douglas DC-
DC-8-50 8-50

0 500 1000 1500 0 100000 200000 300000 400000

Cruising Speed (mph) Passengers x mph

Chapter 1 — Computer Abstractions and Technology — 2


Response Time and Throughput
 Response time
 How long it takes to do a task
 Throughput
 Total work done per unit time

e.g., tasks/transactions/… per hour
 How are response time and throughput affected
by
 Replacing the processor with a faster version?
 Adding more processors?
 We’ll focus on response time for now…

Chapter 1 — Computer Abstractions and Technology — 3


Relative Performance
 Define Performance = 1/Execution Time
 “X is n times faster than Y”
Performanc e X Performanc e Y
Execution time Y Execution time X n
 Example: time taken to run a program
 10s on A, 15s on B
 Execution TimeB / Execution TimeA
= 15s / 10s = 1.5
 So A is 1.5 times faster than B
Chapter 1 — Computer Abstractions and Technology — 4
Measuring Execution Time
 Elapsed time
 Total response time, including all aspects

Processing, I/O, OS overhead, idle time
 Determines system performance
 CPU time
 Time spent processing a given job

Discounts I/O time, other jobs’ shares
 Comprises user CPU time and system CPU
time
 Different programs are affected differently by
CPU and system performance
Chapter 1 — Computer Abstractions and Technology — 5
CPU Clocking
 Operation of digital hardware governed by a
constant-rate clock
Clock period

Clock (cycles)

Data transfer
and computation
Update state

• Clock cycle time/period (T):  Clock period: duration of a clock cycle


– time for a complete clock cycle 
– time between ticks e.g., 250ps = 0.25ns = 250×10 –12
s
– seconds per cycle  Clock frequency (rate): cycles per

• Clock rate/frequency (R): second


 e.g., 4.0GHz = 4000MHz =
– the inverse of the clock period, i.e.,
– cycles per second T 4.0×109Hz
R 1

Chapter 1 — Computer Abstractions and Technology — 7


CPU Time

CPU Time CPU Clock Cycles Clock Cycle Time


CPU Clock Cycles

Clock Rate

 Performance improved by
 Reducing number of clock cycles
 Increasing clock rate

Chapter 1 — Computer Abstractions and Technology — 8


 Our favorite program runs in 10 seconds on computer A,
which has a 2 GHz clock. We are trying to help a
computer designer build a computer, B, which will run
this program in 6 seconds. The designer has determined
that a substantial increase in the clock rate is possible,
but this increase will affect the rest of the CPU design,
causing computer B to require 1.2 times as many clock
cycles as computer A for this program. What clock rate
should we tell the designer to target?

 To run the program in 6 seconds, B must have twice the


clock rate of A.

Chapter 1 — Computer Abstractions and Technology — 9


CPU Time Example
 Computer A: 2GHz clock, 10s CPU time
 Designing Computer B
 Aim for 6s CPU time
 Can do faster clock, but causes 1.2 × clock cycles
 How fast must Computer B clock be?
Clock CyclesB 1.2 Clock CyclesA
Clock RateB  
CPU Time B 6s
Clock CyclesA CPU Time A Clock Rate A
10s 2GHz 20 10 9
1.2 20 10 9 24 10 9
Clock RateB   4GHz
6s 6s
Chapter 1 — Computer Abstractions and Technology — 10
Instruction Count and CPI
Clock Cycles Instructio n Count Cycles per Instructio n
CPU Time Instructio n Count CPI Clock Cycle Time
Instructio n Count CPI

Clock Rate
 Instruction Count for a program
 Determined by program, ISA and compiler
 Average cycles per instruction
 Determined by CPU hardware
 If different instructions have different CPI

Average CPI affected by instruction mix

Chapter 1 — Computer Abstractions and Technology — 11


 Suppose we have two implementations of
the same instruction set architecture.
 Computer A has a clock cycle time of 250
ps and a CPI of 2.0 for some program, and
computer B has a clock cycle time of 500
ps and a CPI of 1.2 for the same program.

 Which computer is faster for this program


and by how much?

Chapter 1 — Computer Abstractions and Technology — 12


CPI Example
 Computer A: Cycle Time = 250ps, CPI = 2.0
 Computer B: Cycle Time = 500ps, CPI = 1.2
 Which is faster, and by how much?

CPU Time Instruction Count CPI Cycle Time


A A A
I 2.0 250ps I 500ps A is faster…
CPU Time Instruction Count CPI Cycle Time
B B B
I 1.2 500ps I 600ps
CPU Time
B I 600ps 1.2
…by this much
CPU Time I 500ps
A
Chapter 1 — Computer Abstractions and Technology — 13
CPI in More Detail
 Different instructions take different amounts of time
depending on what they do:
 Multiplication takes more time than addition
 Floating-point operations take longer than integer ones
 Accessing memory takes more time than accessing
registers

 Instructions can be divided into classes of similar


instructions

 Instructions in the same class have the same Clock cycles


Per Instruction (CPI) value

Chapter 1 — Computer Abstractions and Technology — 15


CPI in More Detail (cont.)
 Total CPU clock cycles for a certain program can be
calculated by looking at various instruction classes and
their individual CPIs

 If different instruction classes take different numbers of


cycles
n
Clock Cycles  (CPIi Instruction Count i )
i1

 – CPIi is the clock cycles per instruction for class i (integer


number),
 – Ci is the count of instructions executed from class i, and
 – n is the number of instruction classes
Chapter 1 — Computer Abstractions and Technology — 16
CPI in More Detail
• Average CPI (CPIaverage or just CPI) for a certain program is the
average number of clock cycles each instruction takes to execute

Relative frequency
• C is the number of instructions executed by the program (known as
the
instruction count, instruction path length, or dynamic program size)

• let the fraction of occurrence (relative frequency) of an


instruction class in a program be
• Thus, CPI depends on the instruction mix (the dynamic
frequency of instructions across the program)
Chapter 1 — Computer Abstractions and Technology — 17
CPI Example
 Alternative compiled code sequences using
instructions in classes A, B, C

Class A B C
CPI for class 1 2 3
IC in sequence 1 2 1 2
IC in sequence 2 4 1 1

 Sequence 1: C = 5  Sequence 2: C = 6
 Clock Cycles  Clock Cycles
= 2×1 + 1×2 + 2×3 = 4×1 + 1×2 + 1×3
= 10 =9
 Avg. CPI = 10/5 = 2.0  Avg. CPI = 9/6 = 1.5
Chapter 1 — Computer Abstractions and Technology — 18
Instructions Per Clock Cycle
 CPI provides one way of comparing two different
implementations of the same ISA, since the number of
instructions executed for a program will be the same

 Although we might expect that the minimum CPI is 1.0,


some processors fetch and execute multiple instructions
per clock cycle (e.g., multicore microprocessors as will
be shown later)

 We could invert CPI to talk about IPC, or instructions


per clock cycle

Chapter 1 — Computer Abstractions and Technology — 19


The CPU Performance Equation

Chapter 1 — Computer Abstractions and Technology — 20


Performance Summary
The BIG Picture
Instructio ns Clock cycles Seconds
CPU Time   
Program Instructio n Clock cycle

Chapter 1 — Computer Abstractions and Technology — 21

You might also like