Updated: October 28, 2024 |
Pipes and FIFOs are both forms of queues that connect processes.
The pipe manager takes care of buffering the data. The buffer size is defined as PIPE_BUF in the <limits.h> file. A pipe is removed once both of its ends have closed. The function pathconf() returns the value of the limit.
Pipes are normally used when two processes want to run in parallel, with data moving from one process to the other in a single direction. (If bidirectional communication is required, messages should be used instead.)
A typical application for a pipe is connecting the output of one program to the input of another program. This connection is often made by the shell. For example:
ls | more
directs the standard output from the ls utility through a pipe to the standard input of the more utility.