Professional Documents
Culture Documents
Pipelining: by Based On The Text Book "Computer Organization" by Carl Hamacher Et Al., Fifth Edition
Pipelining: by Based On The Text Book "Computer Organization" by Carl Hamacher Et Al., Fifth Edition
Pipelining: by Based On The Text Book "Computer Organization" by Carl Hamacher Et Al., Fifth Edition
By K. Santle Camilus
30 40 20 30 40 20 30 40 20 30 40 20
T
a A
s
k
B
O
r
d C
e
r
D
• Sequential laundry takes 6 hours for 4 loads
• If they learned pipelining, how long would laundry take?
Pipelined Laundry
Start work ASAP
6 PM 7 8 9 10 11 Midnight
Time
30 40 40 40 40 20
T
a A
s
k
B
O
r
d C
e
r
D
• Pipelined laundry takes 3.5 hours for 4 loads
• Speedup = 6/3.5 = 1.7
Pipelining Lessons
• Pipelining doesn’t help
6 PM 7 8 9 latency of single task, it
Time helps throughput of
entire workload
T
a 30 40 40 40 40 20 • Pipeline rate limited by
s slowest pipeline stage
k A • Multiple tasks operating
simultaneously
O • Potential speedup =
r B Number pipe stages ???
d
e • Unbalanced lengths of
r C pipe stages reduces
speedup
D
Computer Pipelines
• Pipelining: An implementation technique that
overlaps the execution of multiple
instructions.
• Execute billions of instructions, so
throughput is what matters
Claim: (1) In pipelined two stage of execution, rate of instruction execution is
twice than that achievable by sequential operation. In four stage, it is four times.
• Hamacher says:
Accessing a main memory is 10 times greater than
the time to execute a basic operation inside a processor
If so, what happens to Pipelining ?
Types:
• Data Hazard
• Control or instruction
Hazard
• Structural Hazard
Identify all hazards that may cause the pipeline to
stall and to find ways to minimize impact
Structural Hazard
• Two examples:
Example: A = 3 + A
B=4*A
Assume A= 3,
result for sequential operation: B=24
Result for Pipelined operation: B= 12
( Oops!!! Answer is wrong)
What to do????????????
Data Hazard Mul R2, R3, R4
Example 2 Add R5,R4,R6
What is the solution to
example 2 of data hazard
Solution 1:
• It is a hardware solution
What is the solution to example
2 of data hazard
• Solution 2:
• Alternatively, we look for software solution,
the work of detecting data dependency and
dealing is left to the software, Complier
i1: Mul R2, R3, R4
NOP
NOP
i2: Add R5, R4, R6
In NOP, the complier may reorder the
instruction and perform useful tasks.
Side effects
• In the previous cases, the data dependencies are
explicit because the register are named explicitly.
Clarifications contact:
camilus@nitc.ac.in