lez_01

Upload: sayed1234

Post on 04-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Lez_01

    1/10

    COMPUTER ARCHITECTURE

    Prof. Basel MahafzahLesson 1 - The role of performance - Part 1

    Copyright Universit Telematica Internazionale UNINETTUNO

    The Role ofPerformanceThe Role of

    Performance

    Part 1Part 1

    OutlineOutline

    Computer Performance Computer Performance

    Execution Time Execution Time

    Performance Performance

    Definition of Performance Definition of Performance

    Clock Cycles Clock Cycles

    PerformancePerformance

    What factors of systemperformance are hardwarerelated?

    What factors of systemperformance are hardwarerelated?

    Why is some hardwarebetter than others fordifferent programs?(example: G4 vs. pent. 4)

    Why is some hardwarebetter than others fordifferent programs?(example: G4 vs. pent. 4)

    (e.g., Do we need a new machine,or a new operating system?)

    (e.g., Do we need a new machine,or a new operating system?)

    How does the machinesinstruction set affectperformance?

    How does the machinesinstruction set affectperformance?

    Airplane Passengers Range SpeedAirplane Passengers Range Speed

    Boeing 737 101 630 598

    Boeing 747 470 4150 610

    Concorde 132 4000 1350

    Douglas 146 8720 544

    Boeing 737 101 630 598

    Boeing 747 470 4150 610

    Concorde 132 4000 1350

    Douglas 146 8720 544

    (mi) (mph)(mi) (mph)

    Example on performanceExample on performance

  • 8/13/2019 Lez_01

    2/10

    COMPUTER ARCHITECTURE

    Prof. Basel MahafzahLesson 1 - The role of performance - Part 1

    Copyright Universit Telematica Internazionale UNINETTUNO

    Which of theseairplanes has the best

    performance?

    Which of theseairplanes has the best

    performance?

    The plane with the highestcruising speed is theConcorde

    The plane with the highestcruising speed is theConcorde

    The plane with the longestrange is the Douglas

    The plane with the longestrange is the Douglas

    The plane with the largestcapacity is the Boeing 747

    The plane with the largestcapacity is the Boeing 747

    How much faster is theConcorde compared to the 747?

    How much faster is theConcorde compared to the 747?

    How much bigger is the 747than the Douglas?

    How much bigger is the 747than the Douglas?

    Airplane Passengers SpeedAirplane Passengers Speed

    Boeing 737 101 598

    Boeing 747 470 610

    Concorde 132 1350

    Douglas 146 544

    Boeing 737 101 598

    Boeing 747 470 610

    Concorde 132 1350

    Douglas 146 544

    (mph)(mph)ThroughputThroughput

    228,750228,750

    286,700286,700

    178,200178,200

    79,42479,424

    If we define performance interms of speed, this leaves twopossible definitions:

    If we define performance interms of speed, this leaves twopossible definitions:

    1. Define the fastest plane

    as the one with the highestspeed, taking a singlepassenger from one point toanother in the least time

    1. Define the fastest plane

    as the one with the highestspeed, taking a singlepassenger from one point toanother in the least time

  • 8/13/2019 Lez_01

    3/10

    COMPUTER ARCHITECTURE

    Prof. Basel MahafzahLesson 1 - The role of performance - Part 1

    Copyright Universit Telematica Internazionale UNINETTUNO

    The Concorde would clearlybe the fastest

    The Concorde would clearlybe the fastest

    2. Define the fastest plane asthe one with the highest speed,taking 450 passengers fromone point to another in theleast time

    2. Define the fastest plane asthe one with the highest speed,taking 450 passengers fromone point to another in theleast time

    The Boeing 747 would clearlybe the fastest.Check the following table

    The Boeing 747 would clearlybe the fastest.Check the following table

    Airplane Passengers SpeedAirplane Passengers Speed

    Boeing 737 101 598

    Boeing 747 470 610

    Concorde 132 1350

    Douglas 146 544

    Boeing 737 101 598

    Boeing 747 470 610

    Concorde 132 1350

    Douglas 146 544

    (mph)(mph)ThroughputThroughput

    228,750228,750

    286,700286,700

    178,200178,200

    79,42479,424

    Computer Performance:TIME, TIME, TIMEComputer Performance:TIME, TIME, TIME

    Response Time (latency)Response Time (latency)

    How long does it takefor my job to run?

    How long does it takefor my job to run?

    How long does it taketo execute a job?

    How long does it taketo execute a job?

  • 8/13/2019 Lez_01

    4/10

    COMPUTER ARCHITECTURE

    Prof. Basel MahafzahLesson 1 - The role of performance - Part 1

    Copyright Universit Telematica Internazionale UNINETTUNO

    How long must I waitfor the database query?

    How long must I waitfor the database query?

    The time between the startand completion of a job

    The time between the startand completion of a job

    Throughput Throughput

    What is the averageexecution rate?

    What is the averageexecution rate?

    How many jobs canthe machine run at once?

    How many jobs canthe machine run at once?

    How much work is gettingdone?

    How much work is gettingdone?

    The total amount of workdone in a given time

    The total amount of workdone in a given time

    ExampleExample

    If we upgrade a machine witha new processor what do we

    increase?

    If we upgrade a machine witha new processor what do we

    increase?

    If we add a new machine tothe lab what do we increase?

    If we add a new machine tothe lab what do we increase?

    Answer:Answer:

    Case 1: Both response timeand throughput are improved

    Case 1: Both response timeand throughput are improved

  • 8/13/2019 Lez_01

    5/10

    COMPUTER ARCHITECTURE

    Prof. Basel MahafzahLesson 1 - The role of performance - Part 1

    Copyright Universit Telematica Internazionale UNINETTUNO

    Case 2: No one task gets workdone faster, so onlythroughput increases

    Case 2: No one task gets workdone faster, so onlythroughput increases

    Answer:Answer:

    But by increasing the numberof processors would reducethe waiting time in the queue,therefore response time couldimprove

    But by increasing the numberof processors would reducethe waiting time in the queue,therefore response time couldimprove

    Answer:Answer:

    Execution TimeExecution Time

    Elapsed Time Elapsed Time

    counts everything (disk andmemory accesses, I/O, etc.)

    counts everything (disk andmemory accesses, I/O, etc.)

    a useful number, but oftennot good for comparisonpurposes

    a useful number, but oftennot good for comparisonpurposes

    CPU time CPU time

    Doesnt count I/O or

    time spent running otherprograms

    Doesnt count I/O or

    time spent running otherprograms

    Can be broken up intosystem time, and user time

    Can be broken up intosystem time, and user time

    Our focus: user CPU time Our focus: user CPU time

    time spent executingthe lines of code that arein our program

    time spent executingthe lines of code that areinour program

  • 8/13/2019 Lez_01

    6/10

    COMPUTER ARCHITECTURE

    Prof. Basel MahafzahLesson 1 - The role of performance - Part 1

    Copyright Universit Telematica Internazionale UNINETTUNO

    Example: Unix timeCommand

    Example: Unix timeCommand

    90.7u 12.9s 2:39 65%90.7u 12.9s 2:39 65%90.7u: User CPU Time (seconds)90.7u: User CPU Time (seconds)

    12.9s: System CPU Time (seconds)12.9s: System CPU Time (seconds)

    2:39: Elapsed Time (159 seconds)2:39: Elapsed Time (159 seconds)

    65%: Percentage of Elapsed Time

    that is CPU Time is

    (90.7 + 12.9) / 159 = 0.65

    65%: Percentage of Elapsed Time

    that is CPU Time is

    (90.7 + 12.9) / 159 = 0.65

    More than a third of the elapsedtime in this example was spentwaiting for I/O, running otherprograms, or both

    More than a third of the elapsedtime in this example was spentwaiting for I/O, running otherprograms, or both

    Definition ofPerformanceDefinition ofPerformance

    computer X is n timesfaster than computer YPerformanceX/PerformanceY=n

    computer X is n timesfaster than computer YPerformanceX/PerformanceY=n

    For some program runningon computer X, PerformanceX=1/Execution TimeX

    For some program runningon computer X, PerformanceX=1/Execution TimeX

  • 8/13/2019 Lez_01

    7/10

    COMPUTER ARCHITECTURE

    Prof. Basel MahafzahLesson 1 - The role of performance - Part 1

    Copyright Universit Telematica Internazionale UNINETTUNO

    Answer: A is 1.5 times fasterthan B

    Answer:A is 1.5 times fasterthan B

    Example: Computer A runs a

    program in 10 seconds,Computer B runs the sameprogram in 15 seconds,how much faster is A than B?

    Example: Computer A runs a

    program in 10 seconds,Computer B runs the sameprogram in 15 seconds,how much faster is A than B?

    Clock CyclesClock Cycles

    Instead of reporting executiontime in seconds, we often usecycles

    Instead of reporting executiontime in seconds, we often usecycles

    seconds cycles seconds=

    program program cycle

    seconds cycles seconds=

    program program cycle

    A simple formula relates the mostbasic metrics (clock cycles andclock cycle time) to CPU time:

    A simple formula relates the mostbasic metrics (clock cycles andclock cycle time) to CPU time:

    CPU execution time for aprogram = CPU clock cyclesfor a program X Clock cycletime

    CPU execution time for aprogram = CPU clock cyclesfor a program X Clock cycletime

    Or, because clock rate andclock cycle time are inverses:

    Or, because clock rate andclock cycle time are inverses:

    CPU execution time =CPU clock cycles fora program / Clock rate

    CPU execution time =CPU clock cycles fora program / Clock rate

    Clock ticks indicate whento start activities

    (one abstraction):

    Clockticksindicate whento start activities

    (one abstraction):

    timetime

  • 8/13/2019 Lez_01

    8/10

    COMPUTER ARCHITECTURE

    Prof. Basel MahafzahLesson 1 - The role of performance - Part 1

    Copyright Universit Telematica Internazionale UNINETTUNO

    cycle time = time betweenticks = seconds per cycle cycle time = time betweenticks = seconds per cycle

    clock rate (frequency)= cycles per second(1 Hz.= 1 cycle/sec)

    clock rate (frequency)= cycles per second(1 Hz.= 1 cycle/sec)

    A 200 MHz. clock has aA 200 MHz. clock has a

    1 9 10 = 5 nsec6200 10

    1 9 10 = 5 nsec6200 10

    CycletimeCycletime

    How to ImprovePerformance

    How to ImprovePerformance

    seconds cycles seconds=

    program program cycle

    seconds cycles seconds=

    program program cycle

    So, hardware designer can improveperformance by reducing eitherthe length of the clock cycle or thenumber of clock cycles required fora program.

    So, hardware designer can improveperformance by reducing eitherthe length of the clock cycle or thenumber of clock cycles required fora program.

    ExampleExample

    Our favorite program runs in 10seconds on computer A, which has

    a 400 MHz. clock. We are trying tohelp a computer designer build anew computer B, that will run thisprogram in 6 seconds

    Our favorite program runs in 10seconds on computer A, which has

    a 400 MHz. clock. We are trying tohelp a computer designer build anew computer B, that will run thisprogram in 6 seconds

  • 8/13/2019 Lez_01

    9/10

    COMPUTER ARCHITECTURE

    Prof. Basel MahafzahLesson 1 - The role of performance - Part 1

    Copyright Universit Telematica Internazionale UNINETTUNO

    The designer can use newtechnology to substantiallyincrease the clock rate,but has informed us that thisincrease will affect the rest ofthe CPU design,

    The designer can use newtechnology to substantiallyincrease the clock rate,but has informed us that thisincrease will affect the rest ofthe CPU design,

    causing computer B to require1.2 times as many clock cyclesas computer A for the sameprogram. What clock rateshould we tell the designer totarget?

    causing computer B to require1.2 times as many clock cyclesas computer A for the sameprogram. What clock rateshould we tell the designer totarget?

    AnswerAnswer

    First: find the number of clockcycles required for the programon computer A:

    First: find the number of clockcycles required for the programon computer A:

    CPU timeA = (CPU ClockCyclesA) / Clock RateA

    CPU timeA = (CPU ClockCyclesA) / Clock RateA

    10 seconds =

    (CPU clock cyclesA) / 400 x 106

    cycles/sec

    10 seconds =

    (CPU clock cyclesA) / 400 x 106

    cycles/sec

    CPU clock cyclesA =

    10 sec X 400 X 106 cycles/sec= 4000 X 106 cycles

    CPU clock cyclesA =

    10 sec X 400 X 106 cycles/sec= 4000 X 106 cycles

    CPU time for computer B canbe found using this equation:

    CPU time for computer B canbe found using this equation:

    CPU timeB = (1.2 X CPUclock cyclesA) / Clock rateB

    CPU timeB = (1.2 X CPUclock cyclesA) / Clock rateB

  • 8/13/2019 Lez_01

    10/10

    COMPUTER ARCHITECTURE

    Prof. Basel MahafzahLesson 1 - The role of performance - Part 1

    Copyright Universit Telematica Internazionale UNINETTUNO

    6 seconds = (1.2 X 4000 X 10

    6

    cycles) / Clock rateB

    6 seconds = (1.2 X 4000 X 106

    cycles) / Clock rateB

    Clock rateB = (1.2 X 4000 X 106

    cycles) / 6 seconds = (800 X 106

    cycles) / second = 800 MHz

    Clock rateB = (1.2 X 4000 X 106

    cycles) / 6 seconds = (800 X 106

    cycles) / second = 800 MHz