Pipes and FIFOs

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

For you to use pipes or FIFOs in the BlackBerry 10 OS, the pipe resource manager ( pipe ) must be running.

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, 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 when 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 are essentially the same as pipes, except that FIFOs are named permanent files that are stored in file system directories.
If you want to: Use the:
Create FIFOs from within programs mkfifo() function
Remove FIFOs from within the shell rm utility
Remove FIFOs from within programs remove() or unlink() function

Last modified: 2015-05-07

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus