Pipe-calculus: Difference between revisions

Tags: Mobile edit Mobile web edit
Line 201: Line 201:
==== Pipe and Unix pipelines ====
==== Pipe and Unix pipelines ====


A [[Wikipedia:Pipeline_(Unix)|pipeline]] in Unix shell programming is a good analogy for the pipe combinator. Piped programs execute concurrently. In <math>P1 | P2</math> it cannot occur that the output of <math>P1</math> directly reaches the output of the pipeline.
A [[Wikipedia:Pipeline_(Unix)|pipeline]] in Unix shell programming is a good analogy for the pipe combinator. They have remarkably similar properties. A shell pipeline connects programs that execute concurrently. In <math>P1 | P2</math> it cannot occur that the output of <math>P1</math> directly reaches the output of the pipeline.
If <math>P1</math> exits, <math>P2</math> continues to run, but if <math>P2</math> exits, <math>P1</math> will exit too<ref>The process will exit next time when it writes to its <code>stdout</code>, at least if the default <code>SIGPIPE</code> handler is not replaced by the user.</ref>.
If <math>P1</math> exits, <math>P2</math> continues to run, but if <math>P2</math> exits, <math>P1</math> will exit too<ref>The process will exit next time when it tries to write to <code>stdout</code>, at least if the default <code>SIGPIPE</code> handler is not replaced by the user.</ref>.
Although Unix processes can handle multiple input and output streams, only the standard input and output streams are passed on through the pipe.
Although Unix processes can handle multiple input and output streams, only the standard input and output streams are passed on through the pipe.


283

edits