Pipes and FIFOs

Updated: April 19, 2023

Pipes and FIFOs are both forms of queues that connect processes.

Note: In order for you to use pipes or FIFOs in the QNX Neutrino RTOS, the pipe resource manager (pipe) must be running.
Pipes
A pipe is an unnamed file that serves as an I/O channel between two or more cooperating processes: one process writes into the pipe and the other reads from the pipe.

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.

If you want to: Use the:
Create pipes from within the shell pipe symbol (“|”)
Create pipes from within programs pipe() or popen() functions
FIFOs
FIFOs are essentially the same as pipes, except that FIFOs are named permanent files that are stored in filesystem directories.
If you want to: Use the:
Create FIFOs from within the shell mkfifo utility
Create FIFOs from within programs mkfifo() function
Remove FIFOs from within the shell rm utility
Remove FIFOs from within programs remove() or unlink() function