# 341 Study guide.pdf - LECTURE 1 Response Time and...

• Test Prep
• 27
• 100% (1) 1 out of 1 people found this document helpful

This preview shows page 1 - 7 out of 27 pages.

LECTURE 1 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 Relative Performance Performance = 1 Execution Time Who’s faster? “X is n times faster than Y” Performance X Performance Y = Execution Time X Execution Time Y Measuring Execution Time Elapsed time: Total response time, including all aspects Determines system performance CPU time: Time spent processing a given job Discounts I/O time ○ Comprises user CPU time and system CPU time CPU Clocking Operation of a digital hardware governed by a constant-rate clock
Clock period: Duration of a clock cycle e.g., 250ps = 0.25ns = 250 x 10 -12 s Clock frequency (rate): Cycles per second e.g., 4.0 GHz = 4000 MHz = 4.0 x 10 9 Hz CPU Time: CPU Time = CPU Clock Cycles x Clock Cycle Time = CPU Clock Cycles x 1 Clock Rate = Clock Rate CPU Clock Cycles Performance improved by Reducing number of clock cycles Increasing clock rate Hardware designer must often trade off clock-rate against cycle count CPU Time Example Computer A: 2 GHz clock , 10s CPU time Designing Computer B Aim for 6s CPU time
○ Causes 1.2 x clock cycles A How fast must Computer B clock be? lock rate C B = CPU Time B CPU clock cycles B = ( 6 s ) (1.2 x CPU clock cycles ) A lock cycles CPU Time x Clock rate 10) x (2 GHz ) C A = A A = ( lock rate 4 GHz C B = 6 s ( 1.2 x (10 x 2 GHz ) ) = LECTURE 2 CPU Performance CPU Time: Execution time for a program CPU Time = CPU Clock Cycle * Clock Cycle Time CPU Clock Cycle: Number of cycles/instructions for a program CPU Clock Rate: Number of cycles in one second Clock Cycles / s CPU Clock Rate = 1 Clock Cycle Time Clock Cycle Time: Time for a single cycle Clock Cycle Time = 1 CPU Clock Rate Instruction Count and CPI ● CPI: Average Cycles Per Instruction
PI C = Clock Cycles # of instructions lock Cycles PI (# of instructions ) C = C * PU Time PU Clock Cycles Clock Cycle Time C = C * CPI in More Detail If different instruction classes take different numbers of cycles lock Cycles ( CPI Instruction Count ) C = ∑ n i =1 * i Weighted Average CPI PI ( CPI ) C = Clock Cycles Instruction Count = ∑ n i =1 * Instruction Count Instruction Count i Performance Summary Performance depends on:
○ Algorithm: affects IC, possibly CPI Programming Language: affects IC, CPI ○ Compiler: affects IC, CPI Instruction set architecture: affects IC, CPI, Tc PU Time C = Program Instructions * Instructions Clock Cycles * Seconds Clock Cycle Pitfall: Amdahl’s Law Improving an aspect of a computer and expecting a proportional improvement in overall performance. T T improved = T affected Improvement Factor + unaffected LECTURE 3 Registers vs Memory
Registers are faster to access than memory Operating on memory data requires loads and stores More instructions to be executed Compiler must use registers for variables as much as possible Arithmetic Example C code Compiled MIPS Code f = (g + h) - (i + j) add \$t0, \$s1, \$s2