Coa Unit 1 Problems

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

P a g e | 1.

6 Unit – I: Basic Structure of Computer Sysem

3. PERFORMANCE OF A COMPUTER
Determining the performance of computers
Performance of A Computer
can be tough. Main reasons for this
 Size and Complexity
difficulty are,
 performance improvement techniques
 Size and Complexity of 1. Defining Performance
 Response time
modern software systems,
 Throughput
 Wide range of performance
1
improvement tech niques 𝑃𝑒𝑟𝑓𝑜𝑟𝑚𝑎𝑛𝑐𝑒𝑥 =
𝐸𝑥𝑒𝑐𝑢𝑡𝑖𝑜𝑛 𝑇𝑖𝑚𝑒𝑥
used by hardware designers.
2. Relative Performance
𝑃𝑒𝑟𝑓𝑜𝑟𝑚𝑎𝑛𝑐𝑒𝐴 𝐸𝑥𝑒𝑐𝑢𝑡𝑖𝑜𝑛 𝑇𝑖𝑚𝑒𝐵
3.1. DEFINING PERFORMANCE =
𝑃𝑒𝑟𝑓𝑜𝑟𝑚𝑎𝑛𝑐𝑒𝐵 𝐸𝑥𝑒𝑐𝑢𝑡𝑖𝑜𝑛 𝑇𝑖𝑚𝑒𝐴
If a program is run on two different desktop 3. Measuring Performance
computers, in general the faster one is the  clock time
desktop computer that finishes the job done 4. CPU Execution Time
first. 4.1. Types of CPU time
 User CPU time
Consider a datacenter that had several  System CPU time
servers running jobs submitted by many  System clock
users, in general the faster computer is the  Clock cycles
one that completed the most jobs during a
day.

I NDIVIDUAL computer users are interested in reducing response time .

D AT ACENTER MANAGE RS are often interested in increasing throughput

5. Clock period 3.1.1. RESPONSE TIME


6. CPU Performance and its Factors
𝐶𝑃𝑈 𝐸𝑥𝑒𝑐𝑢𝑡𝑖𝑜𝑛 𝑇𝑖𝑚𝑒 𝑓𝑜𝑟 𝑎 𝑝𝑟𝑜𝑔𝑟𝑎𝑚 It is also called as EXECUTIO N TIME . The total time
𝐶𝑃𝑈 𝐶𝑙𝑜𝑐𝑘 𝐶𝑦𝑐𝑙𝑒 𝑓𝑜𝑟 𝑎 𝑝𝑟𝑜𝑔𝑟𝑎𝑚 required for the computer to complete a task,
= including disk accesses, memory accesses, I/O
𝐶𝑙𝑜𝑐𝑘 𝑅𝑎𝑡𝑒
7. Instruction Performance activities, operating system overhead, CPU
𝐶𝑃𝑈 𝑐𝑙𝑜𝑐𝑘 𝑐𝑦𝑐𝑙𝑒𝑠 execution time, etc.
= 𝐼𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑖𝑜𝑛𝑠 𝑓𝑜𝑟 𝑎 𝑝𝑟𝑜𝑔𝑟𝑎𝑚
× 𝐴𝑣𝑒𝑟𝑎𝑔𝑒 𝑐𝑙𝑜𝑐𝑘 𝑐𝑦𝑐𝑙𝑒𝑠 𝑝𝑒𝑟 𝑖𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑖𝑜𝑛 3.1.2. THROUGHPUT
8. Clock Cycles per Instruction (CPI) It is also called BANDWIDTH . It is the number of
9. CPU Performance Equation tasks completed per unit time.
𝐼𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑖𝑜𝑛 𝑐𝑜𝑢𝑛𝑡 × 𝐶𝑃𝐼
𝐶𝑃𝑈 𝑇𝑖𝑚𝑒 = To maximize performance, we should minimize
𝐶𝑙𝑜𝑐𝑘 𝑅𝑎𝑡𝑒 response time or execution time for some task. We
 Measuring CPU Execution Time can relate performance and execution time for a
 Measuring Clock Cycle Time computer X as, as,
 Measuring Instruction Count 𝟏
𝑷𝒆𝒓𝒇𝒐𝒓𝒎𝒂𝒏𝒄𝒆𝒙 =
𝑬𝒙𝒆𝒄𝒖𝒕𝒊𝒐𝒏 𝑻𝒊𝒎𝒆𝒙

CS8491 – Computer Architecture


Unit – I: Basic Structure of Computer System P a g e | 1.7

Consider two computers X and Y, if the performance of X is greater than the performance of Y, then

𝑷𝒆𝒓𝒇𝒐𝒓𝒎𝒂𝒏𝒄𝒆𝒙 > 𝑷𝒆𝒓𝒇𝒐𝒓𝒎𝒂𝒏𝒄𝒆𝒚

𝟏 𝟏
>
𝑬𝒙𝒆𝒄𝒖𝒕𝒊𝒐𝒏 𝑻𝒊𝒎𝒆𝒙 𝑬𝒙𝒆𝒄𝒖𝒕𝒊𝒐𝒏 𝑻𝒊𝒎𝒆𝒚

𝑬𝒙𝒆𝒄𝒖𝒕𝒊𝒐𝒏 𝑻𝒊𝒎𝒆𝒚 > 𝑬𝒙𝒆𝒄𝒖𝒕𝒊𝒐𝒏 𝑻𝒊𝒎𝒆𝒙

The execution time on Y is more than that of X, if X is faster than Y.

3.1.3. RELATIVE PERFORMANCE


In order to calculate the relative performance consider the following 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.

𝑷𝒆𝒓𝒇𝒐𝒓𝒎𝒂𝒏𝒄𝒆𝑨 𝑬𝒙𝒆𝒄𝒖𝒕𝒊𝒐𝒏 𝑻𝒊𝒎𝒆𝑩


=
𝑷𝒆𝒓𝒇𝒐𝒓𝒎𝒂𝒏𝒄𝒆𝑩 𝑬𝒙𝒆𝒄𝒖𝒕𝒊𝒐𝒏 𝑻𝒊𝒎𝒆𝑨

Thus the performance ratio is

𝟏𝟓/𝟏𝟎 = 𝟏. 𝟓

So A is faster than B in 1.5 times

𝑷𝒆𝒓𝒇𝒐𝒓𝒎𝒂𝒏𝒄𝒆𝑨
= 𝟏. 𝟓
𝑷𝒆𝒓𝒇𝒐𝒓𝒎𝒂𝒏𝒄𝒆𝑩

P ERFORMANCE AND EXECU T I ON TIME ARE RECIPR O CALS , increasing performance decreases execution
time.

3.2. MEASURING PERFORMANCE


Time is used to measure performance of a computer, the computer that performs the same amount of
work in the least time is considered as faster.

Program execution time is measure in SECONDS PER PROGRAM .

The most common definition of time is wall clock time, response ti me or elapsed
time.

Processor may work on several programs simultaneously in order to optimize throughput instead of
minimizing the elapsed time for one program.

We need to differentiate the elapsed time and amount of time which the processor is working on the
program. CPU execution time is used to differentiate this.

CS8491 – Computer Architecture


P a g e | 1.8 Unit – I: Basic Structure of Computer Sysem

3.2.1. CPU EXECUTION TIME


CPU execution time also called CPU time. It is defined as the actual time the CPU spends computing
for a specific task.

3.2.2. TYPES OF CPU TIME


CPU time can be classified into two types

1. User CPU time - CPU time spent in the program


2. System CPU time - CPU time spent in the operating system performing tasks on behalf
of the program.

Differentiating between system and user CPU time is difficult to do accurately, to increase the system
performance the computer designers must know how fast th e hardware can perform
basic functions .

3.2.3. SYSTEM CLOCK


All computers are constructed using a CLOCK that determines when events take place in the hardware.

3.2.4. CLOCK CYCLES


Clock cycles also called tick, clock tick, clock period, clock or cycle. Clock cycle is the time for
one clock period usually of the processor clock, which runs at constant rate.

3.2.5. CLOCK PERIOD


The length of each clock cycle is known as CLOCK PERIOD .

3.3. CPU PERFORMANCE AND ITS FACTORS


Users and designers have different metrics to measure the performance.

In general CPU performance is a one of metrics for measuring the performance. To know the CPU
performance we must find the CPU execution time.

𝑪𝑷𝑼 𝑬𝒙𝒆𝒄𝒖𝒕𝒊𝒐𝒏 𝑻𝒊𝒎𝒆 𝒇𝒐𝒓 𝒂 𝒑𝒓𝒐𝒈𝒓𝒂𝒎


= 𝑪𝑷𝑼 𝑪𝒍𝒐𝒄𝒌 𝑪𝒚𝒄𝒍𝒆 𝒇𝒐𝒓 𝒂 𝒑𝒓𝒐𝒈𝒓𝒂𝒎 × 𝑪𝒍𝒐𝒄𝒌 𝑪𝒚𝒄𝒍𝒆 𝑻𝒊𝒎𝒆

𝟏
𝑪𝒍𝒐𝒄𝒌 𝑪𝒚𝒄𝒍𝒆 𝑻𝒊𝒎𝒆 =
𝑪𝒍𝒐𝒄𝒌 𝑹𝒂𝒕𝒆

𝑪𝑷𝑼 𝑪𝒍𝒐𝒄𝒌 𝑪𝒚𝒄𝒍𝒆 𝒇𝒐𝒓 𝒂 𝒑𝒓𝒐𝒈𝒓𝒂𝒎


𝑪𝑷𝑼 𝑬𝒙𝒆𝒄𝒖𝒕𝒊𝒐𝒏 𝑻𝒊𝒎𝒆 𝒇𝒐𝒓 𝒂 𝒑𝒓𝒐𝒈𝒓𝒂𝒎 =
𝑪𝒍𝒐𝒄𝒌 𝑹𝒂𝒕𝒆

It is clear that the hardware designer can IMPROVE PERFORMANCE by reducing the number of
clock cycles required for a program or the length of th e clock cycle .

CS8491 – Computer Architecture


Unit – I: Basic Structure of Computer System P a g e | 1.9

3.4. INSTRUCTION PERFORMANCE


Performance equations mentioned above does not include any reference to the number of instructions
needed for the program. But the execution time depends on the number of instructions in a program,
so the equation is modified as follows.

𝑪𝑷𝑼 𝒄𝒍𝒐𝒄𝒌 𝒄𝒚𝒄𝒍𝒆𝒔


= 𝑰𝒏𝒔𝒕𝒓𝒖𝒄𝒕𝒊𝒐𝒏𝒔 𝒇𝒐𝒓 𝒂 𝒑𝒓𝒐𝒈𝒓𝒂𝒎 × 𝑨𝒗𝒆𝒓𝒂𝒈𝒆 𝒄𝒍𝒐𝒄𝒌 𝒄𝒚𝒄𝒍𝒆𝒔 𝒑𝒆𝒓 𝒊𝒏𝒔𝒕𝒓𝒖𝒄𝒕𝒊𝒐𝒏

3.4.1. CLOCK CYCLES PER INSTRUCTION (CPI)


 Average number of clock cycles per instruction for a program or program fragment
 Different instructions may take different amounts of time depending on what they do.
 CPI is an average of all the instructions executed in the program.
 CPI provides one way of comparing two different implementations of the same instruction set
architecture.

3.5. CPU PERFORMANCE EQUATION


CPU performance equation in terms of instruction count (the number of instructions executed by the
program), CPI, and clock cycle time is as follows

𝑪𝑷𝑼 𝑻𝒊𝒎𝒆 = 𝑰𝒏𝒔𝒕𝒓𝒖𝒄𝒕𝒊𝒐𝒏 𝒄𝒐𝒖𝒏𝒕 × 𝑪𝑷𝑰 × 𝑪𝒍𝒐𝒄𝒌 𝑪𝒚𝒄𝒍𝒆 𝑻𝒊𝒎𝒆

The clock rate is the inverse of clock cycle time

𝑰𝒏𝒔𝒕𝒓𝒖𝒄𝒕𝒊𝒐𝒏 𝒄𝒐𝒖𝒏𝒕 × 𝑪𝑷𝑰


𝑪𝑷𝑼 𝑻𝒊𝒎𝒆 =
𝑪𝒍𝒐𝒄𝒌 𝑹𝒂𝒕𝒆

These formulas are used to compare two different implementati ons or to evaluate a
design alternative.

3.5.1. MEASURING CPU EXECUTION TIME


 We can measure the CPU execution time by running the program.

3.5.2. MEASURING CLOCK CYCLE TIME


 The clock cycle time is usually provided by the computer manufacturer.

3.5.3. MEASURING INSTRUCTION COUNT


 We can measure the instruction count by using software tools or by using a simulator of the
architecture or using hardware counters,
 Most of the processors have hardware counters, to record the number of instructions executed,
the average CPI, and other sources of performance loss.
 The instruction count depends on the architecture, but not on the exact implementation, so
instruction count can be measured without knowing all the details of the implementation.
 The CPI depends on a wide variety of design details in the computer, including both the
memory system and the processor structure.

CS8491 – Computer Architecture


P a g e | 1.10 Unit – I: Basic Structure of Computer Sysem

Components of performance Units of measure


CPU execution time for a program Seconds for the program
Instruction count Instructions executed for the program
Clock cycles per instruction (CPI) Average number of clock cycles per instruction
Clock cycle time Seconds per clock cycle

Consider the computer with three instruction classes and CPI measurement as given below and
instruction count for each instruction class for the same program from two different compilers
are given. Assume that the computer`s clock rate is 4GHz. Which code sequence will execute
faster according to execution time

Code from CPI for this Instruction Class


A B C
CPI 1 2 3
Code from Instruction Count for each class
A B C
Compiler 1 2 1 2
Compiler 2 4 1 1
[Nov/Dec 2014 – 6M]

𝑰𝒏𝒔𝒕𝒓𝒖𝒄𝒕𝒊𝒐𝒏 𝒄𝒐𝒖𝒏𝒕 × 𝑪𝑷𝑰


𝑪𝑷𝑼 𝑻𝒊𝒎𝒆 =
𝑪𝒍𝒐𝒄𝒌 𝑹𝒂𝒕𝒆

COMPILER 1:
Total CPU time of Compiler 1 is the sum of CPU time of all Instruction Classes

𝑇𝑜𝑡𝑎𝑙 𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶1 = 𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶1𝐴 + 𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶1𝐵 + 𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶1𝐶

2×1 1
𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶1𝐴 = =
4 2
1×2 1
𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶1𝐵 = =
4 2
2×3 3
𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶1𝐶 = =
4 2
1 1 3 5
𝑇𝑜𝑡𝑎𝑙 𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶1 = + + = = 2.5
2 2 2 2

COMPILER 2:
Total CPU time of Compiler 2 is the sum of CPU time of all Instruction Classes

𝑇𝑜𝑡𝑎𝑙 𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶2 = 𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶2𝐴 + 𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶2𝐵 + 𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶2𝐶

4×1
𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶2𝐴 = = 1
4
1×2 1
𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶2𝐵 = = =0.5
4 2

CS8491 – Computer Architecture


Unit – I: Basic Structure of Computer System P a g e | 1.11

2×1 1
𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶2𝐶 = 1 x 3 =
= 0.75
44 2
1 1
𝑇𝑜𝑡𝑎𝑙 𝐶𝑃𝑈 𝑇𝑖𝑚𝑒𝐶2 = 11+
+ 0.5++ 0.75
= 2= 2.25
2 2
The CPU time required for the execution various class of instruction by compiler 2 is less than that of
compiler 1, therefore compiler 2 is faster than compiler 1

4. INSTRUCTIONS: LANGUAGE OF THE COMPUTER


An I NSTRU CTION is a command given
to a computer hardware. The set of Instructions
all instructions understood by a  Instruction Set
specific computer architecture is 1. Operations of the Computer Hardware
 Only one operation
called as I NSTRUCTION S E T OF THE
 Exactly Three Variables
A RCHITECTURE . Design Principle 1: Simplicity Favours Regularity
2. Compiling C statements
Each architecture has its own
instruction set, but the similarity between the instructions are very high because of the reason that all
the hardware work on similar principals and the basic instructions processed similarly.

Common goal of all the computer architects are as follows

 Find an easy language for building hardware


 Maximize Performance
 Minimize Cost and Energy
 Maintain simplicity in design

4.1. OPERATIONS OF THE COMPUTER HARDWARE


Every computer must be able to perform arithmetic operations.

Consider the following MIPS assembly language notation

add a, b, c

It instructs a computer to add the two variables b and c and to put their sum in a.

 Each MIPS arithmetic instruction performs ONLY ONE O PERATION


 It must always have EXACTLY THREE VARIAB LES .

For example, If we want to calculate the sum of four variables b, c, d, e and to place the result in the
variable a.

The following sequence of instructions adds the four variables:

add a, b, c # The sum of b and c is placed in a


add a, a, d # The sum of b, c, and d is now in a
add a, a, e # The sum of b, c, d, and e is now in a

CS8491 – Computer Architecture

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy