0% found this document useful (0 votes)
32 views25 pages

It3030e CA Chap1 Introduction 2.0m

Uploaded by

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

It3030e CA Chap1 Introduction 2.0m

Uploaded by

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

Chapter 1: Introduction

1. Computer Abstraction and Technology


2. Performance Evaluation

[with materials from Computer Organization and Design, 5th Edition,


Patterson & Hennessy, ©2014, MK
IT3030E Fall 2022
and M.J. Irwin’s presentation, PSU 2008] 8
1. Computer Abstraction and Technology
❑ What is a computer?
❑ A machine that
Accepts input data
Processes data by executing a stored program
Produces output

❑ Which one is computer?

IT3030E Fall 2022 10


Classes of Computers
❑ Supercomputers
Super fast + expensive for high-end applications

❑ Server
Network based
High capacity, performance, reliability
Range from small servers to building sized

❑ Desktop computers
General purpose, variety of software
Subject to cost/performance tradeoff

❑ Embedded computers
Hidden as components of systems
Stringent power/performance/cost constraints

IT3030E Fall 2022 11


Price/performance of computer classes

Super $Millions
Mainframe
$100s Ks
Server $10s Ks
Differences in scale,
not in substance Workstation $1000s

Personal $100s

Embedded $10s

IT3030E Fall 2022 13


Levels of Program Code

❑ High-level language
Level of abstraction closer to
problem domain
Provides for productivity and
portability

❑ Assembly language
Textual representation of
instructions

❑ Hardware representation
Binary digits (bits)
Encoded instructions and
data
IT3030E Fall 2022 21
Hardware/software interface: below your program

❑ Application software
Written in high-level language (HLL)

❑ System software
Compiler: translates HLL code to
machine code
Operating System: service code
- Handling input/output
- Managing memory and storage
- Scheduling tasks & sharing resources

❑ Hardware
Processor, memory, I/O controllers

IT3030E Fall 2022 22


Key to computer evolution: IC making technology

The chip manufacturing process

IT3030E Fall 2022 23


Computer Organization
❑ Computer’s basic operation
Input data
Process data by executing stored program
Output data

❑ What are required components of computer?


For data input:
For storing information:
For program execution and data processing:
For data output:

IT3030E Fall 2022 27


Computer Organization
❑ Five classic components of a computer – input, output,
memory, datapath, and control

❑ datapath +
control =
processor
(CPU)

IT3030E Fall 2022 28


2. Computer performance evaluation
❑ What is performance?
❑ A storage system
How much time to find a file/object?
How much time to transfer a file?
How many files can be served simultaneously?

❑ A web server
How fast a request can be served?
How many request can be served per second?

❑ Different criteria to define performance


Throughput
Response time

❑ We focus on response time


IT3030E Fall 2022 31
2. Computer performance evaluation
❑ Response time:
System performance: elapsed time on unload system
CPU performance: user CPU time, the time that CPU actually
spent on executing user program.

❑ To maximize performance, need to minimize execution


time

performanceX = 1 / execution_timeX

If computer X is n times faster than Y, then

performanceX execution_timeY
-------------------- = --------------------- = n
performanceY execution_timeX

IT3030E Fall 2022 32


Relative Performance Example
❑ If computer A runs a program in 10 seconds and
computer B runs the same program in 15 seconds, how
much faster is A than B?
We know that A is n times faster than B if

performanceA execution_timeB
-------------------- = --------------------- = n
performanceB execution_timeA

The performance ratio is 15


------ = 1.5
10
Assume performance of B is 1, then performance of A
is 1.5

IT3030E Fall 2022 33


Performance Factors
❑ CPU execution time (CPU time) – time the CPU spends
working on a task
Does not include time waiting for I/O or running other programs

CPU execution time = # CPU clock cyclesx clock cycle time


for a program for a program

= #-------------------------------------------
CPU clock cycles for a program
clock rate

❑ Can improve performance by reducing either the length


of the clock cycle or the number of clock cycles required
for a program
IT3030E Fall 2022 34
Review: Machine Clock Rate

❑ Clock rate (clock cycles per second in MHz or GHz) is


inverse of clock cycle time (clock period)
CC = 1 / CR

one clock period

10 nsec clock cycle => 100 MHz clock rate


5 nsec clock cycle => 200 MHz clock rate
2 nsec clock cycle => 500 MHz clock rate
1 nsec (10-9) clock cycle => 1 GHz (109) clock rate
500 psec clock cycle => 2 GHz clock rate
250 psec clock cycle => 4 GHz clock rate
200 psec clock cycle => 5 GHz clock rate

IT3030E Fall 2022 35


Improving Performance Example
❑ A program runs on computer A with a 2 GHz clock in 10
seconds. What clock rate must computer B run at to run
this program in 6 seconds? Assume that, computer B
will require 1.2 times as many clock cycles as computer
A to run the program.
CPU timeA = -------------------------------
CPU clock cyclesA
clock rateA

CPU clock cyclesA = 10 sec x 2 x 109 cycles/sec


= 20 x 109 cycles
CPU timeB 1.2 x 20 x 109 cycles
= -------------------------------
clock rateB
1.2 x 20 x 109 cycles = 4 GHz
clock rateB = -------------------------------
6 seconds
IT3030E Fall 2022 36
Clock Cycles per Instruction
❑ Not all instructions take the same amount of time to
execute
Average execution time ~ average clock cycles per instruction

# CPU clock cycles # Instructions Average clock cycles


= x
for a program for a program per instruction

❑ Clock cycles per instruction (CPI) – the average number of


clock cycles each instruction takes to execute
A way to compare two different implementations of the same ISA

CPI for this instruction class


A B C
CPI 1 2 3
IT3030E Fall 2022 37
Using the Performance Equation
❑ Computers A and B implement the same ISA. Computer
A has a clock cycle time of 250 ps and an effective CPI of
2.0 for some program and computer B has a clock cycle
time of 500 ps and an effective CPI of 1.2 for the same
program. Which computer is faster and by how much?
Each computer executes the same number of
instructions, I, so
CPU timeA = I x 2.0 x 250 ps = 500 x I ps
CPU timeB = I x 1.2 x 500 ps = 600 x I ps

Clearly, A is faster … by the ratio of execution times


performanceA execution_timeB 600 x I ps
------------------- = --------------------- = ---------------- = 1.2
performanceB execution_timeA 500 x I ps

IT3030E Fall 2022 38


The Performance Equation
❑ Our basic performance equation is then calculated

CPU time = Instruction_count x CPI x clock_cycle

Instruction_count x CPI
= -----------------------------------------------
clock_rate

❑ Key factors that affect performance (CPU execution time)


The clock rate: CPU specification
CPI: varies by instruction type and ISA implementation
Instruction count: measure by using profilers/ simulators

IT3030E Fall 2022 39


Dynamic Instruction Count

How many Each “for” consists of two


instructions are instructions: increment index,
executed in this check exit condition
program fragment? 12,422,450 Instructions
250 instructions
for i = 1, 100 do 2 + 20 + 124,200 instructions
20 instructions 100 iterations
for j = 1, 100 do 12,422,200 instructions in all
40 instructions 2 + 40 + 1200 instructions
for k = 1, 100 do 100 iterations
10 instructions 124,200 instructions in all
endfor 2 + 10 instructions
endfor 100 iterations for i = 1, n
endfor 1200 instructions in while x > 0
Static count = 326 all

IT3030E Fall 2022 40


Improving performance by CPI
Op Freq CPIi Freq x CPIi
ALU 50% 1 .5 .5 .5 .25
Load 20% 5 1.0 .4 1.0 1.0
Store 10% 3 .3 .3 .3 .3
Branch 20% 2 .4 .4 .2 .4

𝐴𝑣𝑔 𝐶𝑃𝐼 = ෍ 𝑓𝑟𝑒𝑞𝑖 ∗ 𝐶𝑃𝐼𝑖 = 2.2 1.6 2.0 1.95

❑ How much faster would the machine be if a better data cache


reduced the average load time to 2 cycles?
CPU time new = 1.6 x IC x CC so 2.2/1.6 means 37.5% faster
❑ What if branch instruction is only one cycle?
CPU time new = 2.0 x IC x CC so 2.2/2.0 means 10% faster
❑ What if two ALU instructions could be executed at once?
CPU time new = 1.95 x IC x CC so 2.2/1.95 means 12.8% faster
IT3030E Fall 2022 42
How to improve performance?
❑ Shorter clock cycle = faster clock rate
→ latest CPU technology
❑ Smaller CPI
→ optimizing Instruction Set Architecture
❑ Smaller instruction count
→ optimizing algorithm and compiler
❑ To get best performance, multiple criteria are combined
and considered at design time
→ specific CPU for specific class computation problem

IT3030E Fall 2022 43


Faster Clock  Shorter Running Time

Suppose addition takes 1 ns


Clock period = 1 ns; 1 cycle
Clock period = ½ ns; 2 cycles Solution
1 GHz

4 steps

20 steps

2 GHz In this example, addition time


does not improve in going from
1 GHz to 2 GHz clock

Faster steps do not necessarily mean


shorter travel time.

IT3030E Fall 2022 44


Bài 1

a)
IC × CPI 𝐼𝐶 ×1.5
1. CPUtime P1 = = = 0.5 × 10-9 IC
𝐶𝑅 3 𝐺𝐻𝑧
IC × CPI 𝐼𝐶 ×1.0
CPUtime P2 = = = 0.4 × 10-9 IC
𝐶𝑅 2.5 𝐺𝐻𝑧
IC × CPI 𝐼𝐶 ×2.2
CPUtime P3 = = = 0.55 × 10-9 IC
𝐶𝑅 4 𝐺𝐻𝑧

 P2 has smallest CPU time ==> highest performance


2. CPUtime P1 = CPUtime P2 = CPUtime P3 = 10s
IC1 = 20 × 109 ...
3. CPUtime ↓30%, CPI ↑20%
IC × CPI ×1.2
CRnew =
𝐶𝑃𝑈 𝑡𝑖𝑚𝑒 × 0.7
avg CPI(P1) = Σ freqi × CPIi
= 0.1 × 1 + 0.2 × 2 + 0.5 × 3 + 0.2 × 3 = 2.6
avg CPI(P2) = 2.0
IC × CPI 106 × 2.6 IC × CPI 106 × 2.0
CPUtime P1 = = , CPUtime P2 = =
𝐶𝑅 2.5 𝐶𝑅 3.0
cycle

cycle

IC × CPI
1. CPUtime = = IC × CC × CPI
𝐶𝑅
CPUtime 1.8s
CPI = = = 1.8
𝐼𝐶 × CC 109 ×1ns
CPUtime CPUtime
2. CPI(C) = = = 1.1
𝐼𝐶 × CC 6 × 108 × 1ns

==> CPUtime(C) = 6 × 108 × 1ns × 1.1 = 0.66s

# Note:
1 𝐶𝑃𝑈 𝑐𝑙𝑜𝑐𝑘 𝑐𝑦𝑐𝑙𝑒
CC: Clock cycle = 𝐶𝑅 : Clock rate, CPUtime = 𝐶𝑙𝑜𝑐𝑘 𝑟𝑎𝑡𝑒
CPI: Clockcycle per instruction
IC: Instruction count

You might also like