On 28 March 2017 at 01:05, arisawa <[email protected]> wrote:

> the program reads a file and writes it to one end of pipe and then reads
> it from another end of pipe.
> the buffer for writing pipe is named buf0, and for reading pipe is named
> buf.
>

The general problem with this is that a pipe is a full-duplex communication
channel, not a storage device.
The implementation has buffering, but it's not guaranteed to hold a file of
any particular size.
Obviously in practice you're fine if the file is "small enough", but how
small is that?
Having the same process write and read the pipe won't work in general.
The buffer will fill up and the writer will block, which is just right ...
if it's not also the reader.

Reply via email to