Understanding pipes and blocking calls

Kristian Evensen kristian.evensen at gmail.com
Sat Sep 10 06:19:21 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. 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



More information about the Kernelnewbies mailing list