2-Types of Parallelism PDF
2-Types of Parallelism PDF
2-Types of Parallelism PDF
Paralle
l
Divya Gupta
NSUT Dwarka
Types of parallelism:
1. Temporal Parallelism
2. Data Parallelism
3. Mixed Parallelism
Problem
• There are 1000 scripts to be marked.
P1
P1000
P2 :
Output Pile
Input Pile
: P2
P1000 P1
Sequential Solution
Procedure for evaluation
• Step 1: Take an answer book from the pile of
scripts (input)
• Step 2: for I = 1 to 4 do step 3
• Step 3: Grade answer to Qi.
• Step 4: Add marks given for each question
• Step 5: Put the script in the pile of marked
answer books (output)
• Step 6: Repeat steps 1 to 5 until no more
scripts are left in the input
Sequential Solution
Q1 Q2 Q3 Q4
P1
P1 0
Input Pile
P1 5
:
P2
P2 P1 10
:
P2 P1 15
:
P2 P2 20
P3 Output Pile
P1000 P4 P3 25
P3
Time (minutes)
P3
Parallel Solution
Temporal Parallelism
or
Assembly Line Processing
or
Pipeline Processing
Most appropriate if
The jobs to be carried out are identical
A job can be divided into many independent
tasks
Time taken for each task is the same
Time taken to send the task to one worker to
another is negligible as compared to the time
taken to evaluate that task
The number of tasks is much smaller as
compared to the number of jobs to be carried
out (1000 scripts vs 4 answers)
Temporal Parallelism
Let the number of jobs = n (1000)
Let the number of tasks = k (4)
Let the time taken to do a job = p (20)
Let each job be divided into k tasks and each task take equal time
to execute. Let each task be executed by different workers.
P501 P751
: :
: :
: :
P P1000
7
5
0
Data Parallelism
P500
P501
:
:
:
P1000
Combined Data and Temporal
Parallelism
Multiple Pipeline