Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
0 of .
Results for:
P. 1
Parallelism in Algorithms- Bernstein's Conditions

# Parallelism in Algorithms- Bernstein's Conditions

Ratings:

3.0

(1)
|Views: 2,023|Likes:
A very useful document about detection of parallelism in sequential algorithms- Bernstein's Conditions
A very useful document about detection of parallelism in sequential algorithms- Bernstein's Conditions

### Availability:

See more
See less

03/06/2014

pdf

text

original

CS-421 Parallel Processing BE (CIS) Batch 2004-05Handout_12
Page - 1 - of 2
Parallelism in Algorithms – Bernstein’s Conditions
One way to detect parallelism in a sequential algorithm is to look for operations that can becarried out independently of each other.Let, I(s) = input set of statement
1

s
i.e. the set of all variables read by s and O(s) = output set of statement
s
i.e. the set of all variables written by sTwo statements
S
i
and
S
j
are (data) independent if ALL of the following conditions hold:
I(S
j
)
O(S
i
) =
Φ
flow independenceO(S
i
)
O(S
j
) =
Φ
output independence I(S
i
)
O(S
j
) =
Φ
anti independence
That is, two statements
S
i

and
S
j
can be executed in parallel (denoted
S
i
||
S
j
) if [
I(S
j
)
O(S
i
)] U[O(S
i
)
O(S
j
)] U [I(S
i
)
O(S
j
)] =
Φ
These are called
Bernstein’s conditions
and may be seen at different levels of granularity. Forexample, S may be machine-level operations, may be entire procedures or just machineinstructions.In general, a set of statements (processes) S
1,
S
2, …,
S
can execute in parallel if Bernstein’sconditions are satisfied on pair-wise basis i.e. S
1
// S
2
// … // S
iff
S
i
// S
j
i
j
Properties of
Parallelism //
Operator

// is commutative i.e., S
i
// S
j
S
j
// S
i

// is NOT transitive i.e., S
i
// S
j
& S
j
// S
doesn’t imply S
i
// S
These dependences are usually portrayed in the form of a
data-dependence graph
. This is adirected graph having as many nodes as there are procedures (or statements, depending upon thegranularity of the data dependence analysis).
e.g. 1
s
1
:A:= x + B;s
2
: C :=A* 3;s
2
is
flow dependent
on s
1
indicated by an arrowdirected from s
1
to s
2
.
e.g. 2
s
1
:A:= x + B;s
2
:A:= 3;s
2
is
output

dependent
ons
1
indicated by an arrowdirected from s
1
to s
2
witha small circle anywhere onthe arrow.
e.g. 3
s
1
: B :=A+ 3;s
2
:A:= 3;s
2
is
anti dependent
on s
1
indicated by an arrowdirected from s
1
to s
2
witha small line across thearrow.

1
Here
statement
is used in quite a general sense in this handout and it can stand for procedure,process, instruction, etc, whatever be the level of granularity of data dependence analysis asexplained in the class.