Uploaded by suman.202966

Bernstein’s Condition

advertisement
Presentation on
Bernstein’s Condition
Suman Dahal
BE, ME (In Progress), MBA, Mphil
03/01/2022
Outline
• Introduction parallelism and it types
• Bernstein’s conditions to detect parallelism
• Types of dependencies with examples
• References
Introduction
• Parallelism is a condition where multiple processors executes
processes concurrently
• “Philip Alan Bernstein” is a computer scientist specializing in database
research in the Database Group of Microsoft Research. [1]
• Bernstein proposed set of conditions for processes to get executed in
parallel
Types of Parallelism
• Bit-level parallelism: An 8-bit processor requires two instructions whereas
16 bit processor just one instruction for 16 bit addition
• Instruction-level parallelism: It refers to the degree to which, on average,
the instructions of a program can be executed in parallel
• Task Parallelism: Task is decomposed into subtasks and then executed
• Data-level parallelism (DLP): Instructions from a single stream operate
concurrently on several data [2]
Bernstein’s Conditions
• Instruction-level parallelism has five limitations
•
•
•
•
•
True Data dependency (also known as flow dependencies)
Procedural dependency
Resource conflicts
Output dependency
Anti-dependency [3]
• According to Bernstein Processes are executed in parallel if following
three conditions are satisfied:
• No Flow dependency
• No Anti-dependency
• No Output dependency
• However, there exist input/output dependencies and unknown
dependencies too
• Let, Ii (Read Set or Domain)be the set of input variables needed to
execute process Pi and Oi (Write Set or Range)be all the output
variables generated after execution of Pi
• Let’s consider two processes P1 and P2 with input set I1 and I2 and
output set O1 and O2
• According to Bernstein, these two processes can execute in parallel P1
II P2 If they are independent and following conditions are satisfied
• I1 ∩ O2 = φ (Anti dependency does not exist)
• I2 ∩ O1 = φ (Flow dependency does not exist)
• O1 ∩ O2 = φ (Output dependency does not exist)
We have,
1. D and E are the inputs to process 1, are they outputs for any Five processes
other processes?
No, it means there is no anti dependency, the condition “I1 ∩
O2 = φ “ is TRUE
2. C is an output of process 1, Is C input for other processes?
Yes, it is an input for process 2 and process 3, therefore it has
flow dependency, the condition “I2 ∩ O1 = φ” doesn’t exist
3. C is an output of process 1, are there any other process that
has the same output?
Yes, the process 1 and process 4 have the same output, the
condition “O1 ∩ O2 = φ” doesn’t exist [4]
•
•
•
•
•
P1 : C = D x E
P2 : M = G +C
P3 : A = B + C
P4 : C = L + M
P5 : F = G / E
We have,
Five processes
Check the parallelism
Proce Inputs
ss
Outp
ut
Check for P1
Check for P2
Check for P3
P1
{D, E} {C}
P1 is not “II” to
P2, P3 and P4
P2
{G, C} {M}
I2 ∩ O1 ≠ φ
P3
{B, C} {A}
I2 ∩ O1 ≠ φ
P2 II P3
P4
{L, M} {C}
O1 ∩ O2 ≠ φ
I1 ∩ O2 ≠ φ
I1 ∩ O2 ≠ φ
P5
{G, E} {F}
P1 II P5
P2 II P5
P3 II P5
Check
for P4
P4 II P5
•
•
•
•
•
P1 : C = D x E
P2 : M = G +C
P3 : A = B + C
P4 : C = L + M
P5 : F = G / E
• If these processes are executed in sequential model there are five
steps required
• However, execution can be achieved in three steps because
• Step One: P2 II P5 , P3 II P5 also P2 II to P3 results that P2 II P3 II P3
• Step Two: P1 II P5
• Step Three: P4 II P5
• Parallelism follows
• commutative properties Pi II Pj is same as Pj II Pi
• Associative Properties Pi II (Pj II Pk) same as (Pi II Pj) II Pk
• Transitive properties is not always TRUE Pi II Pj and Pj II Pk is not always Pi II Pk
Example
• Let’s consider the following four instructions:
1. S1: Load R1, A (The data from memory location A is copied to register R1)
2. S2: Add R2, R1 (The content of R2, R1 are added and the result is stored in R2)
3. S3: Move R1, R3 (The content of R3 is moved to R1 Register )
4. S4: Store B, R1
(The content of R1 is is stored in a memory location B) [5]
Flow Dependencies
• S1
S2,
S3
Anti Dependencies
• S2
S3
Output Dependencies
• S1
S3
S4,
S2
S2
Dependency Graph
S1
S2
S4
S3
References
• [1] “Phil Bernstein,” Wikipedia, 19-May-2021. [Online]. Available:
https://en.wikipedia.org/wiki/Phil_Bernstein. [Accessed: 01-Jan-2022].[2]
“Enathur: Kanchipuram: Tamil Nadu: India,”
coursematerials/ComArc.pdf, Sri Chandrasekharendra Saraswathi Viswa
Mahavidyalaya,. [Online]. Available: https://kanchiuniv.ac.in/. [Accessed:
01-Jan-2022].
• [3] W. Stalling, Computer Organization and Architecture Designing for
Performance, Ninth. Noida, New Delhi: Pearson Education, 2013.
• [4] “Bernstein's Conditions to detect Parallelism,” YouTube, 09-Sep-2020.
[Online]. Available: https://www.youtube.com/watch?v=KcPpXs2hFtI.
[Accessed: 01-Jan-2022].
• [5] “lec 22 | Data Dependency Example| conditions of parallelism | By
BhanuPriya,” YouTube, 07-Dec-2020. [Online]. Available:
https://www.youtube.com/watch?v=MKxbNhdhncE. [Accessed: 01-Jan2022].
Thank you for your time
Any Queries
Download