Wednesday, 13 January 2016

Some examples based on speedup and Amdahl's law

Here are some of the examples based on speedup and Amdahl's law. The purpose of these examples is to understand the concepts by applying them in given situations.

Example 1:

A computer spends 80 percent of time executing a particular type of instruction. Engineers claim to improve that instruction execution by the factor of 10. What is the resultant speedup obtained?

Sol:

We need to apply Amdahl's law here.













Example 2:

A computer program to be executed by a given processor has the following characteristic:

S.No
Instruction type
% of time
CPI
1
Integer-type
40
1
2
Branch
20
4
3
Load
30
2
4
Store
10
3


The processor is clocked at 2GHz.

Calculate the speedup obtained in each of the cases

1. Branch instruction CPI is changed from 4 to 3

2. Clock frequency is changed from 2GHz to 2.3GHz

3. Store instruction CPI is changed from 3 to 2.

Sol.

     Let us discuss each case one by one.

Case1:  Branch instruction CPI is changed from 4 to 3



Here Frac_used=0.2 (from table given in the table)
Speedup_used= 4/3=1.33

Frac_unused= 1-  Frac_used= 0.8








Case2:  Clock frequency is changed from 2GHz to 2.3GHz




execution time is inversely proportional to the frequency with which the processor is operating.










Case3: Store instruction CPI is changed from 3 to 2



Frac_used=0.1 (from the table given in the question)
speedup_used= 3/2=1.5

Frac_unused= 1- Frac_used=0.9






Saturday, 9 January 2016

Iron law

Iron law is a law or principle which is indisputable and unavoidable. It can be derived by using logic, without the knowledge of any arduous subject. 
In computer architecture and organisation, Iron law is given by

Execution time= (number of instructions executed) * (cycles per instruction (CPI)) * (clock cycle time)

Example 1:

A program executes 3 billion instructions in a processor. The processor spends 2 cycles on each instruction and is working at 3GHz. 

Sol. 















Example2:

A program contains 50 billion instruction whose composition is as follows:

  • 10 billion branch instructions, CPI=4
  • 15 billion load instructions, CPI=2
  • 5 billion store instructions, CPI=3
  • 20 billion integer-type instructions, CPI=1
Evaluate the execution time for above program.

Sol.



















Thursday, 7 January 2016

Speedup and Amdahl's law

Speedup

The term speedup is used to describe how the performance of an architecture change as different improvements are made to it.
Speedup is just the ratio of execution times before and after a change is made.




Let's take an easy example. if a program takes 30 ms to run on old architecture and this architecture is being replaced by another, in which execution time is 15 ms, then we get 

speedup= (30 ms)/(15 ms)=2

This is the speedup if we are using a better version. If we replace our new architecture with older one, then the speedup obtained will be 1/2=0.5


If speedup=1, no improvement

speedup>1, system performance improves

speedup<1, system performance deteriorates


Amdahl's law

According to Amdahl's law,

Frac(unused) is the fraction of time (not instruction) that the improvement is not in use.

Frac(used) is the fraction of the time that improvement is in use and speedup(used) is the speedup that occurs when the improvement is used. 

From Amdahl's law, the thumb rule to improve the system is to improve the common case(instructions whose execution takes most time) first.


Quantifying performance

We all know the performance of computing devices have improved, especially in past decade. Now the question comes- what is performance and how do we compare it?
Generally, performance describes how quickly a given system can execute programs. Computing devices which can do so in less to time can be said to have higher performance.
But which set of programs to choose and how do we quantify performance, which can help in fair comparison of computing devices? These questions will be answered in this post.

Benchmark suites

A benchmark suite consists of a set of programs that represent the characteristics of programs that run into a particular system. After running benchmark suites, devices are given scores based on the time taken to execute them. There are different benchmark suites that estimate system's performance on different types of applications.

One of the best-known benchmark suites is the SPEC suite, produced by Standard Performance Evaluation Corporation.

Metrics in computer architecture

1) MIPS

MIPS(million instructions per second) is calculated by dividing the number of instructions executed in running a program.



where R is the rate of execution of instructions
n= Total number of instructions executed
t= Time taken for execution

If a processor executes at the rate of 1 MIPS, then on an average in one second, it can execute one million instructions.





Rate of execution of Pentium is 126.5 MIPS at 75MHz




Rate of execution of Intel 4004 is 0.07 MIPS at 740kHz





2) CPI/IPC

CPI stands for Cycle per instructions. Mathematically, it is calculated by dividing the number of clock cycles required to execute the program by the number of instructions executed in running the program.
For systems that can execute more than one instruction per cycle, the number of instructions executed per cycle, or IPC, is often used instead of CPI. IPC is calculated by taking the reciprocal of CPI.




CPI= Cycles per instructions
IPC= instructions executed per cycle

Note:

In general, IPC and CPI are a less useful measure of system performance as compared to MIPS, because they do not contain any information about system clock rate or how many instructions the system requires to perform a task.