<s>
In	O
software	B-General_Concept
engineering	I-General_Concept
,	O
a	O
pipeline	B-Operating_System
consists	O
of	O
a	O
chain	O
of	O
processing	O
elements	O
(	O
processes	B-Operating_System
,	O
threads	B-Operating_System
,	O
coroutines	B-Architecture
,	O
functions	O
,	O
etc	O
.	O
</s>
<s>
)	O
,	O
arranged	O
so	O
that	O
the	O
output	O
of	O
each	O
element	O
is	O
the	O
input	O
of	O
the	O
next	O
;	O
the	O
name	O
is	O
by	O
analogy	O
to	O
a	O
physical	O
pipeline	B-Operating_System
.	O
</s>
<s>
Usually	O
some	O
amount	O
of	O
buffering	B-General_Concept
is	O
provided	O
between	O
consecutive	O
elements	O
.	O
</s>
<s>
The	O
information	O
that	O
flows	O
in	O
these	O
pipelines	B-Operating_System
is	O
often	O
a	O
stream	B-Architecture
of	O
records	O
,	O
bytes	O
,	O
or	O
bits	O
,	O
and	O
the	O
elements	O
of	O
a	O
pipeline	B-Operating_System
may	O
be	O
called	O
filters	B-Application
;	O
this	O
is	O
also	O
called	O
the	O
pipe(s )	O
and	O
filters	B-Application
design	O
pattern	O
.	O
</s>
<s>
Connecting	O
elements	O
into	O
a	O
pipeline	B-Operating_System
is	O
analogous	O
to	O
function	B-Application
composition	I-Application
.	O
</s>
<s>
Narrowly	O
speaking	O
,	O
a	O
pipeline	B-Operating_System
is	O
linear	O
and	O
one-directional	O
,	O
though	O
sometimes	O
the	O
term	O
is	O
applied	O
to	O
more	O
general	O
flows	O
.	O
</s>
<s>
For	O
example	O
,	O
a	O
primarily	O
one-directional	O
pipeline	B-Operating_System
may	O
have	O
some	O
communication	O
in	O
the	O
other	O
direction	O
,	O
known	O
as	O
a	O
return	O
channel	O
or	O
backchannel	O
,	O
as	O
in	O
the	B-Language
lexer	I-Language
hack	I-Language
,	O
or	O
a	O
pipeline	B-Operating_System
may	O
be	O
fully	O
bi-directional	O
.	O
</s>
<s>
Flows	O
with	O
one-directional	O
tree	O
and	O
directed	O
acyclic	O
graph	O
topologies	O
behave	O
similarly	O
to	O
(	O
linear	O
)	O
pipelines	B-Operating_System
–	O
the	O
lack	O
of	O
cycles	O
makes	O
them	O
simple	O
–	O
and	O
thus	O
may	O
be	O
loosely	O
referred	O
to	O
as	O
"	O
pipelines	B-Operating_System
"	O
.	O
</s>
<s>
Pipelines	B-Operating_System
are	O
often	O
implemented	O
in	O
a	O
multitasking	B-Operating_System
OS	B-General_Concept
,	O
by	O
launching	O
all	O
elements	O
at	O
the	O
same	O
time	O
as	O
processes	B-Operating_System
,	O
and	O
automatically	O
servicing	O
the	O
data	O
read	O
requests	O
by	O
each	O
process	O
with	O
the	O
data	O
written	O
by	O
the	O
upstream	O
process	O
–	O
this	O
can	O
be	O
called	O
a	O
multiprocessed	O
pipeline	B-Operating_System
.	O
</s>
<s>
In	O
this	O
way	O
,	O
the	O
CPU	B-General_Concept
will	O
be	O
naturally	O
switched	O
among	O
the	O
processes	B-Operating_System
by	O
the	O
scheduler	O
so	O
as	O
to	O
minimize	O
its	O
idle	O
time	O
.	O
</s>
<s>
In	O
other	O
common	O
models	O
,	O
elements	O
are	O
implemented	O
as	O
lightweight	O
threads	B-Operating_System
or	O
as	O
coroutines	B-Architecture
to	O
reduce	O
the	O
OS	B-General_Concept
overhead	O
often	O
involved	O
with	O
processes	B-Operating_System
.	O
</s>
<s>
Depending	O
upon	O
the	O
OS	B-General_Concept
,	O
threads	B-Operating_System
may	O
be	O
scheduled	O
directly	O
by	O
the	O
OS	B-General_Concept
or	O
by	O
a	O
thread	B-Operating_System
manager	O
.	O
</s>
<s>
Coroutines	B-Architecture
are	O
always	O
scheduled	O
by	O
a	O
coroutine	B-Architecture
manager	O
of	O
some	O
form	O
.	O
</s>
<s>
This	O
cannot	O
lead	O
to	O
a	O
deadlock	B-Operating_System
,	O
where	O
both	O
processes	B-Operating_System
would	O
wait	O
indefinitely	O
for	O
each	O
other	O
to	O
respond	O
,	O
since	O
at	O
least	O
one	O
of	O
the	O
two	O
processes	B-Operating_System
will	O
soon	O
thereafter	O
have	O
its	O
request	O
serviced	O
by	O
the	O
operating	B-General_Concept
system	I-General_Concept
,	O
and	O
continue	O
to	O
run	O
.	O
</s>
<s>
For	O
performance	O
,	O
most	O
operating	B-General_Concept
systems	I-General_Concept
implementing	O
pipes	B-Operating_System
use	O
pipe	O
buffers	B-General_Concept
,	O
which	O
allow	O
the	O
source	O
process	O
to	O
provide	O
more	O
data	O
than	O
the	O
destination	O
process	O
is	O
currently	O
able	O
or	O
willing	O
to	O
receive	O
.	O
</s>
<s>
Under	O
most	O
Unices	O
and	O
Unix-like	O
operating	B-General_Concept
systems	I-General_Concept
,	O
a	O
special	O
command	O
is	O
also	O
available	O
which	O
implements	O
a	O
pipe	O
buffer	B-General_Concept
of	O
potentially	O
much	O
larger	O
and	O
configurable	O
size	O
,	O
typically	O
called	O
"	O
buffer	B-General_Concept
"	O
.	O
</s>
<s>
E.g.	O
,	O
if	O
the	O
source	O
process	O
consists	O
of	O
a	O
command	O
which	O
reads	O
an	O
audio	O
track	O
from	O
a	O
CD	B-Device
and	O
the	O
destination	O
process	O
consists	O
of	O
a	O
command	O
which	O
compresses	O
the	O
waveform	O
audio	O
data	O
to	O
a	O
format	O
like	O
MP3	B-Application
.	O
</s>
<s>
In	O
this	O
case	O
,	O
buffering	B-General_Concept
the	O
entire	O
track	O
in	O
a	O
pipe	O
buffer	B-General_Concept
would	O
allow	O
the	O
CD	B-Device
drive	O
to	O
spin	O
down	O
more	O
quickly	O
,	O
and	O
enable	O
the	O
user	O
to	O
remove	O
the	O
CD	B-Device
from	O
the	O
drive	O
before	O
the	O
encoding	O
process	O
has	O
finished	O
.	O
</s>
<s>
Such	O
a	O
buffer	B-General_Concept
command	O
can	O
be	O
implemented	O
using	O
system	B-Operating_System
calls	I-Operating_System
for	O
reading	O
and	O
writing	O
data	O
.	O
</s>
<s>
Wasteful	O
busy	B-Operating_System
waiting	I-Operating_System
can	O
be	O
avoided	O
by	O
using	O
facilities	O
such	O
as	O
poll	B-Language
or	O
select	B-Language
or	O
multithreading	B-Operating_System
.	O
</s>
<s>
Some	O
notable	O
examples	O
of	O
pipeline	B-Operating_System
software	O
systems	O
include	O
:	O
</s>
<s>
CMS	B-Operating_System
Pipelines	I-Operating_System
is	O
a	O
port	O
of	O
the	O
pipeline	B-Operating_System
idea	O
to	O
VM/CMS	B-Application
and	O
z/OS	B-Application
systems	O
.	O
</s>
<s>
It	O
supports	O
much	O
more	O
complex	O
pipeline	B-Operating_System
structures	O
than	O
Unix	B-Application
shells	O
,	O
with	O
steps	O
taking	O
multiple	O
input	B-Architecture
streams	I-Architecture
and	O
producing	O
multiple	O
output	O
streams	O
.	O
</s>
<s>
(	O
Such	O
functionality	O
is	O
supported	O
by	O
the	O
Unix	B-Application
kernel	O
,	O
but	O
few	O
programs	O
use	O
it	O
as	O
it	O
makes	O
for	O
complicated	O
syntax	O
and	O
blocking	O
modes	O
,	O
although	O
some	O
shells	O
do	O
support	O
it	O
via	O
arbitrary	O
file	B-Application
descriptor	I-Application
assignment	O
)	O
.	O
</s>
<s>
Traditional	O
application	O
programs	O
on	O
IBM	O
mainframe	O
operating	B-General_Concept
systems	I-General_Concept
have	O
no	O
standard	O
input	B-General_Concept
and	I-General_Concept
output	I-General_Concept
streams	O
to	O
allow	O
redirection	O
or	O
piping	O
.	O
</s>
<s>
Instead	O
of	O
spawning	O
processes	B-Operating_System
with	O
external	O
programs	O
,	O
CMS	B-Operating_System
Pipelines	I-Operating_System
features	O
a	O
lightweight	O
dispatcher	O
to	O
concurrently	O
execute	O
instances	O
of	O
built-in	O
programs	O
to	O
run	O
the	O
pipeline	B-Operating_System
.	O
</s>
<s>
More	O
than	O
200	O
built-in	O
programs	O
that	O
implement	O
typical	O
UNIX	B-Application
utilities	O
and	O
interface	O
to	O
devices	O
and	O
operating	B-General_Concept
system	I-General_Concept
services	O
.	O
</s>
<s>
In	O
addition	O
to	O
the	O
built-in	O
programs	O
,	O
CMS	B-Operating_System
Pipelines	I-Operating_System
defines	O
a	O
framework	B-Architecture
to	O
allow	O
user-written	O
REXX	B-Language
programs	O
with	O
input	B-General_Concept
and	I-General_Concept
output	I-General_Concept
streams	O
that	O
can	O
be	O
used	O
in	O
the	O
pipeline	B-Operating_System
.	O
</s>
<s>
Data	O
on	O
IBM	O
mainframes	O
typically	O
resides	O
in	O
a	O
Record-oriented	B-Application
filesystem	I-Application
and	O
connected	O
I/O	B-General_Concept
devices	I-General_Concept
operate	O
in	O
record	O
mode	O
rather	O
than	O
stream	B-Architecture
mode	O
.	O
</s>
<s>
As	O
a	O
consequence	O
,	O
data	O
in	O
CMS	B-Operating_System
Pipelines	I-Operating_System
is	O
handled	O
in	O
record	O
mode	O
.	O
</s>
<s>
In	O
general	O
,	O
CMS	B-Operating_System
Pipelines	I-Operating_System
does	O
not	O
buffer	B-General_Concept
the	O
data	O
but	O
passes	O
records	O
of	O
data	O
in	O
a	O
lock-step	O
fashion	O
from	O
one	O
program	B-Application
to	O
the	O
next	O
.	O
</s>
<s>
This	O
ensures	O
a	O
deterministic	O
flow	O
of	O
data	O
through	O
a	O
network	O
of	O
interconnected	O
pipelines	B-Operating_System
.	O
</s>
<s>
Beside	O
byte	O
stream-based	O
pipelines	B-Operating_System
,	O
there	O
are	O
also	O
object	O
pipelines	B-Operating_System
.	O
</s>
<s>
In	O
an	O
object	O
pipeline	B-Operating_System
,	O
processing	O
elements	O
output	O
objects	O
instead	O
of	O
text	O
.	O
</s>
<s>
Windows	B-Application
PowerShell	I-Application
includes	O
an	O
internal	O
object	O
pipeline	B-Operating_System
that	O
transfers	O
.NET	O
objects	O
between	O
functions	O
within	O
the	O
PowerShell	B-Application
runtime	O
.	O
</s>
<s>
Channels	B-Operating_System
,	O
found	O
in	O
the	O
Limbo	B-Application
programming	I-Application
language	I-Application
are	O
other	O
examples	O
of	O
this	O
metaphor	O
.	O
</s>
<s>
Graphical	B-Application
environments	I-Application
such	O
as	O
RISC	B-Operating_System
OS	I-Operating_System
and	O
ROX	B-Language
Desktop	I-Language
also	O
make	O
use	O
of	O
pipelines	B-Operating_System
.	O
</s>
<s>
Rather	O
than	O
providing	O
a	O
save	O
dialog	O
box	O
containing	O
a	O
file	B-Application
manager	I-Application
to	O
let	O
the	O
user	O
specify	O
where	O
a	O
program	B-Application
should	O
write	O
data	O
,	O
RISC	B-Operating_System
OS	I-Operating_System
and	O
ROX	O
provide	O
a	O
save	O
dialog	O
box	O
containing	O
an	O
icon	O
(	O
and	O
a	O
field	O
to	O
specify	O
the	O
name	O
)	O
.	O
</s>
<s>
If	O
the	O
icon	O
is	O
dropped	O
onto	O
a	O
program	B-Application
's	O
icon	O
,	O
it	O
's	O
loaded	O
and	O
the	O
contents	O
that	O
would	O
otherwise	O
have	O
been	O
saved	O
are	O
passed	O
in	O
on	O
the	O
new	O
program	B-Application
's	O
standard	O
input	B-Architecture
stream	I-Architecture
.	O
</s>
<s>
Using	O
GUI	B-Application
pipelines	B-Operating_System
,	O
they	O
could	O
drag	O
the	O
link	O
to	O
their	O
de-archiving	O
program	B-Application
,	O
drag	O
the	O
icon	O
representing	O
the	O
extracted	O
contents	O
to	O
their	O
image	B-Application
editor	I-Application
,	O
edit	O
it	O
,	O
open	O
the	O
save	O
as	O
dialog	O
,	O
and	O
drag	O
its	O
icon	O
to	O
their	O
uploading	O
software	O
.	O
</s>
<s>
In	O
practice	O
,	O
this	O
is	O
often	O
not	O
the	O
case	O
,	O
so	O
GUI	B-Application
pipelines	B-Operating_System
are	O
rare	O
.	O
</s>
<s>
The	O
name	O
"	O
pipeline	B-Operating_System
"	O
comes	O
from	O
a	O
rough	O
analogy	O
with	O
physical	O
plumbing	O
in	O
that	O
a	O
pipeline	B-Operating_System
usually	O
allows	O
information	O
to	O
flow	O
in	O
only	O
one	O
direction	O
,	O
like	O
water	O
often	O
flows	O
in	O
a	O
pipe	O
.	O
</s>
<s>
Pipes	B-Operating_System
and	O
filters	B-Application
can	O
be	O
viewed	O
as	O
a	O
form	O
of	O
functional	B-Language
programming	I-Language
,	O
using	O
byte	O
streams	O
as	O
data	O
objects	O
;	O
more	O
specifically	O
,	O
they	O
can	O
be	O
seen	O
as	O
a	O
particular	O
form	O
of	O
monad	O
for	O
I/O	B-General_Concept
.	O
</s>
<s>
The	O
concept	O
of	O
pipeline	B-Operating_System
is	O
also	O
central	O
to	O
the	O
Cocoon	B-Language
web	O
development	O
framework	B-Architecture
or	O
to	O
any	O
XProc	B-Language
(	O
the	O
W3C	O
Standards	O
)	O
implementations	O
,	O
where	O
it	O
allows	O
a	O
source	O
stream	B-Architecture
to	O
be	O
modified	O
before	O
eventual	O
display	O
.	O
</s>
<s>
This	O
pattern	O
encourages	O
the	O
use	O
of	O
text	O
streams	O
as	O
the	O
input	B-General_Concept
and	I-General_Concept
output	I-General_Concept
of	O
programs	O
.	O
</s>
<s>
This	O
reliance	O
on	O
text	O
has	O
to	O
be	O
accounted	O
when	O
creating	O
graphic	B-Application
shells	O
to	O
text	O
programs	O
.	O
</s>
