Revision Slides
Revision Slides
Assume each
operation takes one
nanosecond (10-9
seconds).
8
Speedup
Number of cores = p
Serial run-time = Tserial
Parallel run-time = Tparallel
u p
ed
s pe
r
lin
ea
Tparallel = Tserial / p
9
Speedup of a parallel program
Tserial
S=
Tparallel
10
Efficiency of a parallel program
Tserial
S Tparallel Tserial
E= = =
p p
.
p Tparallel
11
Speedups and
efficiencies of a parallel
program
12
Example
We can parallelize 90% of a serial
program.
Parallelization is “perfect”
regardless of the number of cores p
we use.
Tserial = 20 seconds
Runtime
0.9 x T of
/ p parallelizable
serial = 18 / p part is
13
Example (cont.)
Runtime of “unparallelizable” part is
0.1 x Tserial = 2
14
Example (cont.)
Speed up
Tserial 20
S= =
0.9 x Tserial / p + 0.1 x Tserial 18 / p + 2
15
PARALLEL PROGRAM
DESIGN
16
Foster’s methodology
17
Foster’s methodology
2. Communication: determine what communication
needs to be carried out among the tasks
identified in the previous step.
18
Foster’s methodology
3. Agglomeration or aggregation: combine tasks
and communications identified in the first step
into larger tasks.
19
Foster’s methodology
4. Mapping: assign the composite tasks identified in
the previous step to processes/threads.
20
Concurrency VS Parallelism
Concurrency vs.
Parallelism
■ Concurrency means dealing with several things at once
□ Programming concept for the developer
□ In shared-memory systems, implemented by time sharing
■ Parallelism means doing several things at once
□ Demands parallel hardware
■ Parallel programming is a misnomer
□ Concurrent programming aiming at parallel execution
■ Any parallel software is concurrent software
□ Note: Some researchers disagree, most practitioners agree
■ Concurrent software is not always parallel software
Concurrency
□ Many server applications achieve scalability
by optimizing concurrency only (web server)
Parallelism
Server Example:
No Concurrency, No
Parallelism
Receive request A
Fetch A data
Return A data
R
e
t
Client Core 1u Storage
r
n
r
e
s
u
Server Example:
Concurrency for
Throughput
Client 1 Client 2 Core 1 Storage
Receive request A
Fetch A data
R
e
c
e
i
v
e
r
e
q
u
e
s
t
Client 1 Client 2 Core 1 Storage
B
Server Example:
Parallelism for Throughput
Client 1 Client 2 Core 1 Core 2 Storage
Receive request A
Receive quest B
re
Fe tch A data
Fetch B data
Return B data
Return A data