Thread (2 messages) 2 messages, 2 authors, 2011-09-15

Understanding pipes and blocking calls

From: Sri Ram Vemulpali <hidden>
Date: 2011-09-15 15:50:37

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
[off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help