Title: CSECE Computer Architecture
1CS/ECE Computer Architecture
- Lecture 2
- SOUNDARARAJAN EZEKIEL
- Department of Computer Science
- Ohio Northern University
2LAB Issue
- We have LOGIC WORKS and DIGITAL WORKS
- You can use any one of the software
- Both are working good
- You Decide Which One you want to use
3Chapter 2. The Role of Performance
- Time is the measure of computer performance
- Metrics
- Processor Cycle Time (MHz)
- Execution Time (response time)
- How fast a program finishes
- Throughput time
- the total amount of work done in a given time
- Cycles per instructions--CPI
- Millions of instruction per second MIPS
4Execution Time
- Wall-clock /response/elapsed time
- Start the program and watch the clock, when the
programs ends that is wall-clock time, This
includes disk access, memory access, I/O every
thing. - Drawback what if more than one program is
running on your machine, what if the program ask
for the user input and wait for it . - CPU Time
- measure the processor time along not including
I/O - divide into 1. User time (time spend on user
mode) and 2. System time ( time spend on OS)
5Example
- Unix Mode time command will give
- 90.7 u 12.9s 239 65gt user time, system
time, elapsed time, and elapsed time - we often use throughput to measure
- of lines of codes per day, of bits per second
transmitted over a wire
Program time
CPU wait CPU wait CPU
wait CPU
CPU time
I/O time
Total time CPU Time Wait(I/O) time
6Continue
- Often, processor performance is only quoted in
terms of latency - Program A ran 20 times faster than program B
- But for many applications, throughput is much
more important than latency - 3 jobs J1, J2, J3 takes 11 seconds gt throughput
3/11 jobs per second
7Clock Frequency Clock Cycles
- Every processor has an internal clock that runs
at a constant rate and determines when events
happen in the hardware - cycles per seconds-- Hertz
- 800MHzgt 800106 cycles per second
- This is called Clock Frequency
- Clock cycle time1/Clock frequency
- Example Clock Frequency 100 Hz
- Clock Cycle1/1000.01 seconds
- 800MHz machine has clock cycle of 1/8001061.25
nanoseconds(nano10(-9)
8Basic
- What is a clock? Clock is a free running signal
with a fixed cycle time - CPU time by using cycles
- CPU timeCPU clock cyclesClock cycle time
- CPU timeCPU clock cycles for a prog/clock freq
- Quiz ACPU clock frequency is 1 MHz a program
takes 4.5 million cycles to execute B CPU
freq 500 MHz, Prog takes 45 million cycles - What is CPU time for Case A and CaseB
9Answer
- Case A 4.5106(1/ 106)4.5 s
- Case B 45106(1/500106)0.09 s
- CPI (Cycles per instruction) Average instruction
execution timeCPU time/No of instruction - this is average of all type of execution
- it is useful to compare two different
implementation of the same architecture - MIPS Millions of instructions per second
- MIPSclock frequency/CPI
10MIPS cont
- when comparing 2 machines A and B with the same
instruction set , MIPS is a fair comparison
(some times) - But, MIPS can be meaningless indicator of
performance - Example Machine A has special instruction need
to do some square rootgt 100cycles to executegt
1/100 MIPS0.01 MIps - machine B do square root by using software(add,
mult, shift..) gt 1 cycle to executegt1 MIPS
11Two Machines Comparison
- Compare CPU time for 2 machines
- Program takes 109 instructions
- Machine A 1.2 CPI , 2 ns(clock period)
- Machine B 2.5 CPI , 1 ns(clock period)
- Quiz Which machine is faster? How Much?
12Answer
- CPU time of Instruction Average Instruction
time - Average instruction time
- Machine A 2.4 ns
- machine B 2.5 ns
- CPU time
- machine A 109 2.42.4 sec
- machine B 1092.5 2.5 sec
- Machine A is faster
- How much faster 2.5/2.41.05 times faster
13Performance comparison
- why do you want to compare 2 machines or 2
programs - understand which is better
- for market rate
- help customer to understand and buy their machine
- we use to say A is faster than B
- gt response time(exe time) of A lt exe time of B
- gt A n times faster than B
- gt Exe time of B/Exe time of A n (1/performance
of B)/(1/performance of A)perof A/per of B - Performance Exe time are RECIPROCAL
14which is the best?
M2
M3
M1
P1
10
20
1
P2
20
100
1000
P3
40
110
1001
M1 is 10 times faster than M2 for P1 M2 is 10
times faster than M1 for P2 M1 is 20 times faster
than M3 for P1 M3 is 50 times faster than M1 for
P2 M2 is 2 times faster than M3 for P1 M3 is 5
times faster than M2 for P2
15Example
B
A
P1
2s
4s
P2
12s
8s
How much faster A than B Case1 ratio of run
times Normalize A P1 4/2 p28/12 A is
2 times faster than B for P1 and 2/3 times for
P2 By average 2(2/3)4/3 times
faster than B Case 2 Normalize B
P1 2/4 p2 12/8 average ( 0.51.5)/2 1
so A is ONE time faster than B Case 3 A took 14
s for P1 and P2 B took 12 s for for
P1P2 A takes 14/12 of times of B, that is A is
6/7 faster than B why we get three different
answers? Three different equations --- they are
all reasonable calculations conclusion We need
to be more precise about performance and
metrics