PDC - Lecture - No. 2
PDC - Lecture - No. 2
Computing
Lecture 2
Amdahl’s Law
Outline
Karp-Flatt Metric
Types of Parallelism
Data-parallelism
Functional-parallelism
Pipelining
Multi-processor vs Multi-computer
Derivation
Let’s suppose you have a sequential code for a problem that
can be executed in total T(s)time.
T(p) be the parallel time for the same algorithm over p
processors.
Then speedup can be calculated using:-
Derivation
Again
1. Data-parallelism
When there are independent tasks applying the same operation
to different elements of a data set
Example code
for i= to 99 do
a[ i ] = b[ i ] + c [ i ]
Endfor
2. Functional-parallelism
When there are independent tasks applying different operations
to different data elements
Example code
1) a=2
2) b=3
3) m= (a+b)/2
4) s= ( + )/2
5) v= s -
Here third and fourth statements could be performed
concurrently.
Types of Parallelism
3. Pipelining
Usually used for the problems where single instance of the
problem can not be parallelized
The output of one stage is input of the other stage
Dividing whole computation of each instance into multiple
stages provided that there are multiple instances of the problem
An effective method of attaining parallelism on the
uniprocessor architectures
Depends on pipelining abilities of the processor
Types of
Parallelism
3. Pipelining
Example:
Assembly line
analogy
Sequential Execution
Types of
Parallelism
3. Pipelining
Example:
Assembly line
analogy
Pipelining
Types of
Parallelism
3. Pipelining
Example:
Overlap
instructions in a
single instruction
cycle to achieve
parallelism
4-stage Pipelining
Multi-processor
vs
Multi-Computer
Multi-Processor
i. Centralized Multi-processor
Additional CPUs are attached to the
system bus, and all the processors
share the same primary memory
All the memory is at one place and
has the same access time from every
processor
Also known to as UMA(Uniform
Memory Access) multi-processor or
SMP (symmetrical Multi-processor )
Multi-Processor
Cache Coherence:
When we are in a distributed environment, each CPU’s cache needs to
be consistent (continuously needs to be updated for current values),
which is known as cache coherence.
Snooping:
Snoopy protocols achieve data consistency between the cache memory
and the shared memory through a bus-based memory system. Write-
invalidate and write-update policies are used for maintaining cache
consistency.
Branch Prediction:
Branch prediction is a technique used in CPU design that attempts to
guess the outcome of a conditional operation and prepare for the most
likely result.
Questions
CS3006 - Fall 2021