Docsity

Laundry Example, Sequential Laundry - Lecture Slides | CIT 595, Study notes of Computer Science

Toggle sidebar
bg1
Pipelining
(Introduction)
CIT 595
Spring 2009
Additional material ยฉ 2004/2005 Lewis/Martin
Modified by Diana Palsetia
Real-World Pipelines: Car Washes
๎˜
Idea
๎˜
Divide process into independent
stages
๎˜
Move objects through stages in
sequence
๎˜
At any given times, multiple
objects being processed
Sequential Parallel
Pipelined
CIT 595 3
Laundry Example
๎˜
Ann, Brian, Cathy and Dave each
have one load of clothes to wash,
dry and fold
๎˜
Washer takes 30 mins
๎˜
Dryer takes 40 mins
๎˜
โ€œFolderโ€ takes 20 mins
CIT 595 4
Sequential Laundry
๎˜
Entire workload takes 6 hours to complete
pf3
pf4

Partial preview of the text

Download Laundry Example, Sequential Laundry - Lecture Slides | CIT 595 and more Study notes Computer Science in PDF only on Docsity!

Pipelining^ (Introduction)^ CIT 595Spring 2009 Additional material ยฉ 2004/2005 Lewis/MartinModified by Diana Palsetia

Real-World Pipelines: Car Washes

^ Idea^ ^ Divide process into independentstages^ ^ Move objects through stages insequence^ ^ At any given times, multipleobjects being processed

Sequential^

Parallel Pipelined

CIT 595^

3

Laundry Example

^ Ann, Brian, Cathy and Dave eachhave one load of clothes to wash,dry and fold ^ Washer takes 30 mins ^ Dryer takes 40 mins ^ โ€œFolderโ€ takes 20 mins

CIT 595^

Sequential Laundry

^ Entire workload takes 6 hours to complete

CIT 595^

5

Pipelined Laundry ^ Pipelined Laundry takes only 3.5 hours ^ Speedup = 6/3.5 = 1.7 ^ Pipelining did not reduce completion time for one task but it helps thethroughput of the entire workload in turn decreasing the completion time

CIT 595^ Instruction Level Pipelining: Big Picture  We exploit idleness of instruction cycle to allow instructions to beexecuted in parallel (exploit parallelism at instruction level)  For each stage, one phase of instruction is carried out, and the stagesare overlapped  Each stage of the Instruction Processing Cycle takes 1 clock cycle^ S1. Fetch instruction

S4. Fetch operands S2. Decode opcode

S5. Execute S3. Evaluate Address

S6. Store result

Theoretical Speedup due to Pipelining  The theoretical speedup offered by a pipeline can bedetermined as follows:  Let^ k^ be total number of stages and CIT 595

t be the time per stage p^ ^ Let^ n^ be the total number of tasks ^ The first task (instruction) requires

k^ ร—ร—ร—ร—^ t time to complete in a p^ k -stage pipeline.  The remaining (

n^ - 1) tasks emerge from the pipeline

one per

cycle^ So the total time to complete the remaining tasks is

( n^ -

  1. tp  Thus, to complete^ n

tasks using a^ k -stage pipeline requires: ( k^ ร—ร—^ t ) + ( n^ - 1) t ร—ร— p

= ( k^ +^ n^ - 1) tp p

CIT 595^ Theoretical Speedup due to Pipelining  If we take the time required to complete

n^ tasks without a pipeline and divide it by the time it takes to complete

n^ tasks using a pipeline, we find:  If we take the limit as

n^ approaches infinity, (

k^ +^ n^ - 1) approaches

n,

which results in a theoretical speedup of:

t= k x tn^ p

CIT 595^

13

Impact on Clock cycle time due to Pipelining ^ Recall^ timeprogram ^ Lower time per cycle ->lower CPU time ->improvesperformance ^ This implies that we if we shorten the time per pipelinestages, we will lower clock cycle time^ ^ This can be achieved by adding more pipe stages ofshorter duration

cycle

cyclesinstructionstimeinstruction

program x^ = x^ Instruction CountCPI Clock Cycletime CPU Time^ =

CIT 595^

5 stage 10 stage โ€“ clock cycletime reduced by one half20 stage โ€“ clock cycletime reduced by onefourth

Impact on Clock cycle time due to Pipelining

CIT 595^

15

Impact on CPI

^ In pipelining, one instruction is in each stage ^ Since one instruction will be fetched (or finish) eachcycle, the average CPI will equal 1 (obviously we areignoring the very first instruction โ€“ cold start) ^ However, CPI = 1 is barely achieved

CIT 595

Limitations ^ The buffers (registers) to hold data & control adddelay ^ We assume that the pipeline can be kept filled atall times^ ^ However, this is not always the case due to what isknown as

Pipeline Hazards Mainly due to Data & Control/Branch dependencies  To avoid hazards extra circuitry needs to put in place which willadd delay  Branch/Control add to more delays due if pipelines are verydeep