Pipe-calculus: Difference between revisions

Line 113: Line 113:
=== The pipe combinator ===
=== The pipe combinator ===


The pipe combinator is the first one where behavior plays a role and thus one can think of its operands as processes.
After discussing sequence and choice, the pipe combinator is the first where communication occurs between processes.
<math>s \rhd t</math> is a composite process that enforces unidirectional flow of information between its component processes according to the following diagram.
<math>s \rhd t</math> is a composite process that enforces unidirectional data flow between its components according to the following diagram.


<math>\to \underset{s \rhd t}{\boxed{\to \boxed{s} \to \boxed{t} \to}} \to</math>
<math>\underset{s \rhd t}{\boxed{\to \boxed{s} \to \boxed{t} \to}}</math>


Compared to the parallel composition <math>\mid</math> in [[Wikipedia:π-calculus|π-calculus]], <math>\rhd</math> can be classified as unidirectional parallel composition.  
Compared to the parallel composition <math>\mid</math> in [[Wikipedia:π-calculus|π-calculus]], <math>\rhd</math> can be classified as unidirectional parallel composition.  
Line 123: Line 123:
Synchronisation and communication
Synchronisation and communication


A [[Wikipedia:Pipeline_(Unix)|pipeline]] in shell programming is a good analogy for the pipe combinator. Piped programs execute concurrently. It cannot occur that in <code>P1 | P2</code> the output of <code>P1</code> directly reaches the output of the pipeline.
==== Pipe and Unix pipelines ====


One can also think of <math>\rhd</math> in a syntactic setting. In this case the left hand side operand represents ''input'', while the right hand side operand plays the role of a ''recognizer'', ''parser'' or ''interpreter''.
A [[Wikipedia:Pipeline_(Unix)|pipeline]] in Unix shell programming is a good analogy for the pipe combinator. Piped programs execute concurrently. It cannot occur that in <math>P1 | P2</math> the output of <math>P1</math> directly reaches the output of the pipeline.
It is an essential difference though that Unix processes can handle more than one input and output streams, and only the standard input and output streams are passed on through the pipe. Another difference is the degree of concurrency. Race conditions can't occur between pipe-calculus processes unlike between OS level processes<ref>That's why I prefer the term ''cooperation'' to describe the interdependencies of pipe-calculus processes.</ref>.


==== Recognition and interpretation ====
==== Recognition and interpretation ====
One can also think of <math>s \rhd t</math> in a syntactic setting. In this case <math>s</math> represents ''input'' or ''source'', while <math>t</math> plays the role of a ''recognizer'', ''parser'' or ''interpreter''.


== Formal Definition ==
== Formal Definition ==
283

edits