<s>
In	O
computing	O
,	O
a	O
pipeline	B-Operating_System
,	O
also	O
known	O
as	O
a	O
data	B-General_Concept
pipeline	I-General_Concept
,	O
is	O
a	O
set	O
of	O
data	O
processing	O
elements	O
connected	O
in	O
series	O
,	O
where	O
the	O
output	O
of	O
one	O
element	O
is	O
the	O
input	O
of	O
the	O
next	O
one	O
.	O
</s>
<s>
The	O
elements	O
of	O
a	O
pipeline	B-Operating_System
are	O
often	O
executed	O
in	O
parallel	O
or	O
in	O
time-sliced	O
fashion	O
.	O
</s>
<s>
Some	O
amount	O
of	O
buffer	B-General_Concept
storage	I-General_Concept
is	O
often	O
inserted	O
between	O
elements	O
.	O
</s>
<s>
Computer-related	O
pipelines	B-Operating_System
include	O
:	O
</s>
<s>
Instruction	B-General_Concept
pipelines	I-General_Concept
,	O
such	O
as	O
the	O
classic	B-General_Concept
RISC	I-General_Concept
pipeline	I-General_Concept
,	O
which	O
are	O
used	O
in	O
central	B-General_Concept
processing	I-General_Concept
units	I-General_Concept
(	O
CPUs	O
)	O
and	O
other	O
microprocessors	B-Architecture
to	O
allow	O
overlapping	O
execution	O
of	O
multiple	O
instructions	O
with	O
the	O
same	O
circuitry	O
.	O
</s>
<s>
The	O
circuitry	O
is	O
usually	O
divided	O
up	O
into	O
stages	O
and	O
each	O
stage	O
processes	B-Operating_System
a	O
specific	O
part	O
of	O
one	O
instruction	O
at	O
a	O
time	O
,	O
passing	O
the	O
partial	O
results	O
to	O
the	O
next	O
stage	O
.	O
</s>
<s>
They	O
are	O
related	O
to	O
the	O
technologies	O
of	O
superscalar	B-General_Concept
execution	I-General_Concept
,	O
operand	B-General_Concept
forwarding	I-General_Concept
,	O
speculative	B-General_Concept
execution	I-General_Concept
and	O
out-of-order	B-General_Concept
execution	I-General_Concept
.	O
</s>
<s>
Graphics	B-General_Concept
pipelines	I-General_Concept
,	O
found	O
in	O
most	O
graphics	B-Architecture
processing	I-Architecture
units	I-Architecture
(	O
GPUs	B-Architecture
)	O
,	O
which	O
consist	O
of	O
multiple	O
arithmetic	O
units	O
,	O
or	O
complete	O
CPUs	O
,	O
that	O
implement	O
the	O
various	O
stages	O
of	O
common	O
rendering	O
operations	O
(	O
perspective	B-Architecture
projection	I-Architecture
,	O
window	O
clipping	B-Algorithm
,	O
color	O
and	O
light	O
calculation	O
,	O
rendering	O
,	O
etc	O
.	O
</s>
<s>
Software	O
pipelines	B-Operating_System
,	O
which	O
consist	O
of	O
a	O
sequence	O
of	O
computing	O
processes	B-Operating_System
(	O
commands	O
,	O
program	O
runs	O
,	O
tasks	O
,	O
threads	O
,	O
procedures	O
,	O
etc	O
.	O
</s>
<s>
The	O
Unix	B-Application
system	I-Application
call	O
pipe	B-Operating_System
is	O
a	O
classic	O
example	O
of	O
this	O
concept	O
.	O
</s>
<s>
HTTP	B-Protocol
pipelining	I-Protocol
,	O
the	O
technique	O
of	O
issuing	O
multiple	O
HTTP	B-Protocol
requests	I-Protocol
through	O
the	O
same	O
TCP	O
connection	O
,	O
without	O
waiting	O
for	O
the	O
previous	O
one	O
to	O
finish	O
before	O
issuing	O
a	O
new	O
one	O
.	O
</s>
<s>
Some	O
operating	B-General_Concept
systems	I-General_Concept
may	O
provide	O
UNIX-like	B-Operating_System
syntax	O
to	O
string	O
several	O
program	O
runs	O
in	O
a	O
pipeline	B-Operating_System
,	O
but	O
implement	O
the	O
latter	O
as	O
simple	O
serial	O
execution	O
,	O
rather	O
than	O
true	O
pipelining	B-General_Concept
—	O
namely	O
,	O
by	O
waiting	O
for	O
each	O
program	O
to	O
finish	O
before	O
starting	O
the	O
next	O
one	O
.	O
</s>
<s>
Pipelining	B-General_Concept
is	O
a	O
commonly	O
used	O
concept	O
in	O
everyday	O
life	O
.	O
</s>
<s>
By	O
using	O
a	O
pipeline	B-Operating_System
of	O
three	O
stations	O
,	O
the	O
factory	O
would	O
output	O
the	O
first	O
car	O
in	O
45	O
minutes	O
,	O
and	O
then	O
a	O
new	O
one	O
every	O
20	O
minutes	O
.	O
</s>
<s>
As	O
this	O
example	O
shows	O
,	O
pipelining	B-General_Concept
does	O
not	O
decrease	O
the	O
latency	O
,	O
that	O
is	O
,	O
the	O
total	O
time	O
for	O
one	O
item	O
to	O
go	O
through	O
the	O
whole	O
system	O
.	O
</s>
<s>
Since	O
the	O
throughput	O
of	O
a	O
pipeline	B-Operating_System
cannot	O
be	O
better	O
than	O
that	O
of	O
its	O
slowest	O
element	O
,	O
the	O
designer	O
should	O
try	O
to	O
divide	O
the	O
work	O
and	O
resources	O
among	O
the	O
stages	O
so	O
that	O
they	O
all	O
take	O
the	O
same	O
time	O
to	O
complete	O
their	O
tasks	O
.	O
</s>
<s>
That	O
way	O
,	O
the	O
items	O
will	O
flow	O
through	O
the	O
pipeline	B-Operating_System
at	O
a	O
constant	O
speed	O
,	O
like	O
waves	O
in	O
a	O
water	O
channel	O
.	O
</s>
<s>
In	O
such	O
"	O
wave	O
pipelines	B-Operating_System
"	O
,	O
no	O
synchronization	O
or	O
buffering	O
is	O
needed	O
between	O
the	O
stages	O
,	O
besides	O
the	O
storage	O
needed	O
for	O
the	O
data	O
items	O
.	O
</s>
<s>
More	O
generally	O
,	O
buffering	O
between	O
the	O
pipeline	B-Operating_System
stages	O
is	O
necessary	O
when	O
the	O
processing	O
times	O
are	O
irregular	O
,	O
or	O
when	O
items	O
may	O
be	O
created	O
or	O
destroyed	O
along	O
the	O
pipeline	B-Operating_System
.	O
</s>
<s>
For	O
example	O
,	O
in	O
a	O
graphics	B-General_Concept
pipeline	I-General_Concept
that	O
processes	B-Operating_System
triangles	O
to	O
be	O
rendered	O
on	O
the	O
screen	O
,	O
an	O
element	O
that	O
checks	O
the	O
visibility	O
of	O
each	O
triangle	O
may	O
discard	O
the	O
triangle	O
if	O
it	O
is	O
invisible	O
,	O
or	O
may	O
output	O
two	O
or	O
more	O
triangular	O
pieces	O
of	O
the	O
element	O
if	O
they	O
are	O
partly	O
hidden	O
.	O
</s>
<s>
The	O
buffer	B-General_Concept
between	O
two	O
stages	O
may	O
be	O
simply	O
a	O
hardware	B-General_Concept
register	I-General_Concept
with	O
suitable	O
synchronization	O
and	O
signalling	O
logic	O
between	O
the	O
two	O
stages	O
.	O
</s>
<s>
If	O
the	O
processing	O
times	O
of	O
an	O
element	O
are	O
variable	O
,	O
the	O
whole	O
pipeline	B-Operating_System
may	O
often	O
have	O
to	O
stop	O
,	O
waiting	O
for	O
that	O
element	O
and	O
all	O
the	O
previous	O
ones	O
to	O
consume	O
the	O
items	O
in	O
their	O
input	B-General_Concept
buffers	I-General_Concept
.	O
</s>
<s>
The	O
frequency	O
of	O
such	O
pipeline	B-General_Concept
stalls	I-General_Concept
can	O
be	O
reduced	O
by	O
providing	O
space	O
for	O
more	O
than	O
one	O
item	O
in	O
the	O
input	B-General_Concept
buffer	I-General_Concept
of	O
that	O
stage	O
.	O
</s>
<s>
Such	O
a	O
multiple-item	O
buffer	B-General_Concept
is	O
usually	O
implemented	O
as	O
a	O
first-in	B-Operating_System
,	I-Operating_System
first-out	I-Operating_System
queue	I-Operating_System
.	O
</s>
<s>
The	O
upstream	O
stage	O
may	O
still	O
have	O
to	O
be	O
halted	O
when	O
the	O
queue	O
gets	O
full	O
,	O
but	O
the	O
frequency	O
of	O
those	O
events	O
will	O
decrease	O
as	O
more	O
buffer	B-General_Concept
slots	O
are	O
provided	O
.	O
</s>
<s>
Queueing	O
theory	O
can	O
tell	O
the	O
number	O
of	O
buffer	B-General_Concept
slots	O
needed	O
,	O
depending	O
on	O
the	O
variability	O
of	O
the	O
processing	O
times	O
and	O
on	O
the	O
desired	O
performance	O
.	O
</s>
<s>
If	O
some	O
stage	O
takes	O
(	O
or	O
may	O
take	O
)	O
much	O
longer	O
than	O
the	O
others	O
,	O
and	O
cannot	O
be	O
speed	O
up	O
,	O
the	O
designer	O
can	O
provide	O
two	O
or	O
more	O
processing	O
elements	O
to	O
carry	O
out	O
that	O
task	O
in	O
parallel	O
,	O
with	O
a	O
single	O
input	B-General_Concept
buffer	I-General_Concept
and	O
a	O
single	O
output	O
buffer	B-General_Concept
.	O
</s>
<s>
As	O
each	O
element	O
finishes	O
processing	O
its	O
current	O
data	O
item	O
,	O
it	O
delivers	O
it	O
to	O
the	O
common	O
output	O
buffer	B-General_Concept
,	O
and	O
takes	O
the	O
next	O
data	O
item	O
from	O
the	O
common	O
input	B-General_Concept
buffer	I-General_Concept
.	O
</s>
<s>
This	O
concept	O
of	O
"	O
non-linear	O
"	O
or	O
"	O
dynamic	O
"	O
pipeline	B-Operating_System
is	O
exemplified	O
by	O
shops	O
or	O
banks	O
that	O
have	O
two	O
or	O
more	O
cashiers	O
serving	O
clients	O
from	O
a	O
single	O
waiting	O
queue	O
.	O
</s>
<s>
In	O
some	O
applications	O
,	O
the	O
processing	O
of	O
an	O
item	O
Y	O
by	O
a	O
stage	O
A	O
may	O
depend	O
on	O
the	O
results	O
or	O
effect	O
of	O
processing	O
a	O
previous	O
item	O
X	O
by	O
some	O
later	O
stage	O
B	O
of	O
the	O
pipeline	B-Operating_System
.	O
</s>
<s>
This	O
situation	O
occurs	O
very	O
often	O
in	O
instruction	B-General_Concept
pipelines	I-General_Concept
.	O
</s>
<s>
In	O
order	O
to	O
handle	O
such	O
conflicts	O
correctly	O
,	O
the	O
pipeline	B-Operating_System
must	O
be	O
provided	O
with	O
extra	O
circuitry	O
or	O
logic	O
that	O
detects	O
them	O
and	O
takes	O
the	O
appropriate	O
action	O
.	O
</s>
<s>
In	O
instruction	B-General_Concept
pipelines	I-General_Concept
,	O
this	O
technique	O
is	O
called	O
out-of-order	B-General_Concept
execution	I-General_Concept
.	O
</s>
<s>
Guess	O
and	O
backtrack	O
:	O
One	O
important	O
example	O
of	O
item-to-item	O
dependency	O
is	O
the	O
handling	O
of	O
a	O
conditional	B-General_Concept
branch	I-General_Concept
instruction	O
X	O
by	O
an	O
instruction	B-General_Concept
pipeline	I-General_Concept
.	O
</s>
<s>
The	O
first	O
stage	O
A	O
of	O
the	O
pipeline	B-Operating_System
,	O
that	O
fetches	O
the	O
next	B-General_Concept
instruction	I-General_Concept
Y	O
to	O
be	O
executed	O
,	O
cannot	O
perform	O
its	O
task	O
until	O
X	O
has	O
fetched	O
its	O
operand	O
and	O
determined	O
whether	O
the	O
branch	O
is	O
to	O
be	O
taken	O
or	O
not	O
.	O
</s>
<s>
Rather	O
than	O
halt	O
while	O
waiting	O
for	O
X	O
to	O
be	O
finished	O
,	O
stage	O
A	O
may	O
guess	O
whether	O
the	O
branch	O
will	O
be	O
taken	O
or	O
not	O
,	O
and	O
fetch	O
the	O
next	B-General_Concept
instruction	I-General_Concept
Y	O
based	O
on	O
that	O
guess	O
.	O
</s>
<s>
Namely	O
,	O
all	O
the	O
changes	O
that	O
were	O
made	O
to	O
the	O
machine	O
's	O
state	O
by	O
stage	O
A	O
and	O
subsequent	O
stages	O
based	O
on	O
that	O
guess	O
would	O
have	O
to	O
be	O
undone	O
,	O
the	O
instructions	O
following	O
X	O
already	O
in	O
the	O
pipeline	B-Operating_System
would	O
have	O
to	O
be	O
flushed	O
,	O
and	O
stage	O
A	O
would	O
have	O
to	O
restart	O
with	O
the	O
correct	O
instruction	B-General_Concept
pointer	I-General_Concept
.	O
</s>
<s>
This	O
branch	B-General_Concept
prediction	I-General_Concept
strategy	O
is	O
a	O
special	O
case	O
of	O
speculative	B-General_Concept
execution	I-General_Concept
.	O
</s>
<s>
To	O
be	O
effectively	O
implemented	O
,	O
data	B-General_Concept
pipelines	I-General_Concept
need	O
a	O
CPU	B-General_Concept
scheduling	B-Application
strategy	O
to	O
dispatch	O
work	O
to	O
the	O
available	O
CPU	B-General_Concept
cores	O
,	O
and	O
the	O
usage	O
of	O
data	B-General_Concept
structures	I-General_Concept
on	O
which	O
the	O
pipeline	B-Operating_System
stages	O
will	O
operate	O
on	O
.	O
</s>
<s>
For	O
example	O
,	O
UNIX	B-Application
derivatives	O
may	O
pipeline	B-Operating_System
commands	O
connecting	O
various	O
processes	B-Operating_System
 '	O
standard	O
IO	O
,	O
using	O
the	O
pipes	B-Operating_System
implemented	O
by	O
the	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
Lower	O
level	O
approaches	O
may	O
rely	O
on	O
the	O
threads	O
provided	O
by	O
the	O
operating	B-General_Concept
system	I-General_Concept
to	O
schedule	O
work	O
on	O
the	O
stages	O
:	O
both	O
thread	O
pool-based	O
implementations	O
or	O
on	O
a	O
one-thread-per-stage	O
are	O
viable	O
,	O
and	O
exist	O
.	O
</s>
<s>
Other	O
strategies	O
relying	O
on	O
cooperative	B-Operating_System
multitasking	I-Operating_System
exist	O
,	O
that	O
do	O
not	O
need	O
multiple	O
threads	O
of	O
execution	O
and	O
hence	O
additional	O
CPU	B-General_Concept
cores	O
,	O
such	O
as	O
using	O
a	O
round-robin	O
scheduler	O
with	O
a	O
coroutine-based	O
framework	O
.	O
</s>
<s>
Moreover	O
,	O
the	O
transfer	O
of	O
items	O
between	O
separate	O
processing	O
elements	O
may	O
increase	O
the	O
latency	O
,	O
especially	O
for	O
long	O
pipelines	B-Operating_System
.	O
</s>
<s>
The	O
additional	O
complexity	O
cost	O
of	O
pipelining	B-General_Concept
may	O
be	O
considerable	O
if	O
there	O
are	O
dependencies	O
between	O
the	O
processing	O
of	O
different	O
items	O
,	O
especially	O
if	O
a	O
guess-and-backtrack	O
strategy	O
is	O
used	O
to	O
handle	O
them	O
.	O
</s>
<s>
Indeed	O
,	O
the	O
cost	O
of	O
implementing	O
that	O
strategy	O
for	O
complex	O
instruction	O
sets	O
has	O
motivated	O
some	O
radical	O
proposals	O
to	O
simplify	O
computer	B-General_Concept
architecture	I-General_Concept
,	O
such	O
as	O
RISC	B-Architecture
and	O
VLIW	B-General_Concept
.	O
</s>
<s>
Compilers	B-Language
also	O
have	O
been	O
burdened	O
with	O
the	O
task	O
of	O
rearranging	O
the	O
machine	O
instructions	O
so	O
as	O
to	O
improve	O
the	O
performance	O
of	O
instruction	B-General_Concept
pipelines	I-General_Concept
.	O
</s>
<s>
For	O
example	O
,	O
building	O
pipelines	B-Operating_System
with	O
single	O
node	O
applications	O
that	O
trawl	O
through	O
the	O
data	O
row	O
by	O
row	O
is	O
no	O
longer	O
feasible	O
with	O
the	O
volume	O
and	O
variety	O
of	O
big	B-Application
data	I-Application
.	O
</s>
<s>
However	O
,	O
with	O
the	O
advent	O
of	O
data	O
analytics	O
engines	O
such	O
as	O
Hadoop	B-Application
,	O
or	O
more	O
recently	O
Apache	B-Language
Spark	I-Language
,	O
it	O
's	O
been	O
possible	O
to	O
distribute	O
large	O
datasets	O
across	O
multiple	O
processing	O
nodes	O
,	O
allowing	O
applications	O
to	O
reach	O
heights	O
of	O
efficiency	O
several	O
hundred	O
times	O
greater	O
than	O
was	O
thought	O
possible	O
before	O
.	O
</s>
<s>
The	O
effect	O
of	O
this	O
today	O
is	O
that	O
even	O
a	O
mid-level	O
PC	O
using	O
distributed	O
processing	O
in	O
this	O
fashion	O
can	O
handle	O
the	O
building	O
and	O
running	O
of	O
big	B-Application
data	I-Application
pipelines	B-Operating_System
.	O
</s>
