CS2004D Computer Organization
Instructor: Sumesh T A
Department of Computer Science &
Engineering
NIT Calicut
Kerala, India
COMPUTER ORGANIZATION AND DESIGN 5th
The Hardware/Software Interface Edition
Chapter 1
Performance
When trying to choose among different computers,
performance is an important attribute.
Often, salespeople would like you to see their computer in
the best possible light, whether or not this light accurately
reflects the needs of the purchaser’s application.
Hence, understanding how best to measure performance
and the limitations of performance measurements is
important in selecting a computer.
When we say one computer has better performance than
another, what do wemean?
Passenger airplane analogy
You could define the fastest plane as the one with the highest
cruising speed, taking a single passenger from one point to another
in the least time
If you were interested in transporting 450 passengers from one
point to another, however, the 747 would clearly be the fastest,
§1.6 Performance
Defining Performance
Which airplane has the best performance?
Boeing 777 Boeing 777
Boeing 747 Boeing 747
BAC/Sud Concorde BAC/Sud Concorde
Douglas DC-8-50 Douglas DC- 8-50
0 100 200 300 400 0 2000 4000 6000 8000 10000
500
Passenger Capacity Cruising Range (miles)
Boeing 777 Boeing 777
Boeing 747 Boeing 747
BAC/Sud BAC/Sud
Concorde Concorde
Douglas Douglas DC-
DC-8- 8-50
50
0 500 1000 1500 0 100000 200000 300000 400000
Cruising Speed (mph) Passengers x mph
Chapter 1 — Computer Abstractions and Technology — 5
Faster computer
If you were running a program on two different desktop
computers, you’d say that the faster one is the desktop
computer that gets the job done first.
If you were running a datacenter that had several
servers running jobs submitted by many users, you’d say
that the faster computer was the one that completed the
most jobs during a day.
• Response time - the time between the start and
completion of a task
• Through put - the total amount of work done in a
given time
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
Do the following changes to a computer system
increase throughput, decrease response time, or
both?
1. Replacing the processor in a computer with a
faster version
2. Adding additional processors to a system that
uses multiple processors for separate
We’ll focus on response time for now…
Chapter 1 — Computer Abstractions and Technology — 7
Time is the measure of computer performance: the computer
that performs the same amount of work in the least time is the
fastest.
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 = 1½
So A is 1½ times faster than B
Chapter 1 — Computer Abstractions and Technology — 9
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
Minus I/O time, other jobs’ shares
Includes user CPU time and system CPU time
Different programs are affected differently by CPU
and system performance
Running on servers – I/O performance – hardware and
software
Total elapsed time is of interest
Define performance metric and then proceed
Chapter 1 — Computer Abstractions and Technology — 10
CPU Clocking
Operation of digital hardware governed by a
constant-rate clock
clock period is the length of each clock cycle.
Clock period
Clock (cycles)
Data transfer and computation
Update state
Clock period: duration of a clock cycle
e.g., 250ps = 0.25ns = 250×10–12s
Clock frequency (rate): cycles per second
e.g., 4.0GHz = 4000MHz = 4.0×109Hz
Chapter 1 — Computer Abstractions and Technology — 11
CPU Time
CPU Time CPU Clock Cycles Clock Cycle
Time
CPU Clock Cycles Clock Rate
Performance can be improved by
Reducing number of clock cycles
Increasing clock rate
Hardware designer must often trade off clock
rate against cycle count
Chapter 1 — Computer Abstractions and Technology — 13
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 RateB Clock CyclesB 1.2 Clock
CPU TimeB 6s
CyclesA
Clock CyclesA CPU Time A Clock RateA
10s 2GHz 20 10 9
1.2 20 109 24
Clock RateB 4GHz
109 6s 6s
Chapter 1 — Computer Abstractions and Technology — 15
Instruction Count and CPI
Clock Cycles Instruction Count Cycles Per Instruction
CPU Time Instruction Count CPI Clock Cycle
Time
Instruction Count CPI
Instruction Count for a program
Clock Rate
Determined by program, ISA, and compiler
Average cycles per instruction
Determined by CPU hardware
If different instructions have different CPI
Average CPI gets affected by instruction mix
(dynamic frequency of instructions)
Chapter 1 — Computer Abstractions and Technology — 16
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?
CPI Example
Computer A: Cycle Time = 250ps, CPI = 2.0
Computer B: Cycle Time = 500ps, CPI = 1.2
Same ISA
Which is faster? by how much?
CPU Time A Instruction Count CPIA Cycle Time
A is faster…
A
I 2.0 250ps I 500ps
CPU TimeB Instruction Count CPIB Cycle TimeB
CPU TimeB I 600ps …by this much
1.2
I1.2 500ps I 600ps
CPU Time A I 500ps
Chapter 1 — Computer Abstractions and Technology — 18
CPI in More Detail
If different instruction classes take different
numbers of cycles
n
Clock Cycles (CPIi Instructio n
Count i )
Weighted average CPI
i1
Clock Cycles n
CPI CPIi Instruction Count i
Instruction
i1 Instruction Count
Count
Relative frequency
Chapter 1 — Computer Abstractions and Technology — 19
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: IC = 5 Sequence 2: IC = 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 — 21
The performance of a program depends on the algorithm, the
language, the compiler, the architecture, and the actual hardware.
IPC
Although you might expect that the minimum CPI is
1.0, as we’ll see in Chapter 4, some processors fetch
and execute multiple instructions per clock cycle.
To reflect that approach, some designers invert CPI
to talk about IPC, or instructions per clock cycle. If a
processor executes on average 2 instructions per
clock cycle, then it has an IPC of 2 and hence a CPI
of 0.5.
Performance Summary
The BIG Picture
Instructions Clock Cycles Seconds
CPU Time
Program Instruction Clock Cycle
Performance depends on
Algorithm: affects IC, possibly CPI
Programming language: affects IC, CPI
Compiler: affects IC, CPI
Instruction set architecture: affects IC, CPI, Tc
Chapter 1 — Computer Abstractions and Technology — 24
§1.7 The Power Wall
Power Trends
Clock rate and Power for Intel x86 microprocessors over eight generations
In CMOS IC technology
Power Capacitive load Voltage 2
Frequency
×30 5V → 1V ×1000
Chapter 1 — Computer Abstractions and Technology — 25
Power
Reducing Power
Suppose we developed a new, simpler processor that has 85% of the
capacitive load of the more complex older processor. Further, assume that
it has adjustable voltage so that it can reduce voltage 15% compared to
processor B, which results in a 15% shrink in frequency. What is the
impact on dynamic power?
P C 0.85 (V 0.85)2 F 0.85
0.85 4
Pnew old C V
old
2
F old
old old
old
old 0.52
The power wall
We can’t reduce voltage further
We can’t remove more heat
How else can we improve performance?
Chapter 1 — Computer Abstractions and Technology — 27
§1.8 The Sea Change: The Switch to Multiprocessors
Technology driven
Uniprocessor Performance
Advanced architectural and organizational ideas
Constrained by power, instruction-level parallelism, memory latency
Chapter 1 — Computer Abstractions and Technology — 28
Multiprocessors
Multicore microprocessors
More than one processor per chip
Requires explicitly parallel programming
Compare with instruction level parallelism
Hardware executes multiple instructions at once
Hidden from the programmer
Hard to do (Why?)
Programming for performance
Load balancing
Optimizing communication and synchronization
For both this analogy and parallel programming, the challenges
include scheduling, load balancing, time for synchronization, and
overhead for communication between the parties.
Chapter 1 — Computer Abstractions and Technology — 29
§1.9 Concluding Remarks
Concluding Remarks
Cost/performance is improving
Due to underlying technology development
Hierarchical layers of abstraction
In both hardware and software
Instruction set architecture
The hardware/software interface
Execution time: the best performance
measure
Power is a limiting factor
Use parallelism to improve performance
Chapter 1 — Computer Abstractions and Technology — 30
Acknowledgement
The slides are adopted from Computer
Organization and Design, 5th Edition
by David A. Patterson and John L. Hennessy
2014, published by MK (Elsevier)
Chapter 1 — Computer Abstractions and Technology — 31