Re: OT: shell and output redirection

  • From: Tim Gorman <tim@xxxxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Sat, 03 Jul 2004 19:22:26 -0600

As Mladen said, the programs execute simultaneously, but "program-b" will
block on its read from "stdin" until "program-a" places something into the
memory buffer of the pipe.

Likewise, "program-a" will block on writes to "stdout" if the volume of data
written to the memory buffer of the pipe tries to exceed the size of the
buffer (i.e. 8-32Kb on most *nixes).

It's a beautiful (and transparent) mechanism for which someone should have
received a Nobel Prize.  Since it sometimes takes 35-45 years for a Nobel to
be awarded, maybe it's on its way?


on 7/2/04 1:04 PM, Mladen Gogala at mladen@xxxxxxxxxxxxxxx wrote:

> 
> On 07/02/2004 02:50:44 PM, Tanel P?der wrote:
>> Hi!
>> 
>> When I redirect output from program a to program b using a shell pipe, when
>> is the receiving procedure executed?
> 
> Programs are executed simultaneously. Pseudocode goes like this:
> create pipe
> fork process 1 {
>  open pipe for output
> exec program 1 }
> fork process 2 {
>  open pipe for input
>  exec program 2 }
> 
> wait for the first one to complete.

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: