Understanding pipes and blocking calls

Sri Ram Vemulpali sri.ram.gmu06 at gmail.com
Thu Sep 15 11:50:37 EDT 2011


> Hi,
>
> I am working on a simple command line application for Linux, in order
> to properly understand how pipes and blocking calls interact.

blocking is different from pipes. Blocking calls can be set and unset
on fds which is only relevant to vfs layer.

Pipes are more of way of communication. They transmit byte by byte data
without any format.

 The
> application writes some data to stdout, before sleeping and then
> writing some more.
 I have set stdout to be unbuffered, and do an
> fflush before the sleep to be absolutely sure that there is no
> buffered data left.
so you have set it to asynchronous mode
and stdout is not a pipe. It is stdio FILE* pointer

 When I try to pipe this data to another
> application, the receiving application does not progress before the
> sleep is over.
can you post your code

 Based on my understanding of pipes, the two
> applications are independent and, thus, the receiving application
> should not be affected by any sleeps in the producer of data. Is this
> incorrect, and is there a way to fix this (i.e., having blocking calls
> in the producer)?
>

On Sat, Sep 10, 2011 at 6:19 AM, Kristian Evensen
<kristian.evensen at gmail.com> wrote:
> Hi,
>
> I am working on a simple command line application for Linux, in order
> to properly understand how pipes and blocking calls interact. The
> application writes some data to stdout, before sleeping and then
> writing some more. I have set stdout to be unbuffered, and do an
> fflush before the sleep to be absolutely sure that there is no
> buffered data left. When I try to pipe this data to another
> application, the receiving application does not progress before the
> sleep is over. Based on my understanding of pipes, the two
> applications are independent and, thus, the receiving application
> should not be affected by any sleeps in the producer of data. Is this
> incorrect, and is there a way to fix this (i.e., having blocking calls
> in the producer)?
>
> Thanks in advance,
> Kristian
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Regards,
Sri.



More information about the Kernelnewbies mailing list