Differences between revisions 3 and 4
Revision 3 as of 2008-05-22 22:50:19
Size: 863
Editor: GreyCat
Comment: clean up, adjust link
Revision 4 as of 2008-11-22 14:08:38
Size: 864
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 28: Line 28:
For some more information, see [:BashFAQ/085:Bash FAQ #85]. For some more information, see [[BashFAQ/085|Bash FAQ #85]].

Working with Named Pipes

Pipes allow processes to to communicate with each other. A pipe may also be known as a "FIFO" (First In, First Out).

The following is an example on how to create a named pipe, named here as pipe1.

 cd /tmp
 mkfifo pipe1

To send a message to the pipe, use:

 echo "hello" > pipe1

The process will appear to be hung at this point. There is no other process running to collect the data, so the kernel suspends the process. The process is said to be "blocked" at this stage.

On another terminal, it is possible to collect the data from the pipe, as follows:

 cat < /tmp/pipe1

The data from the pipe will now be read by cat (and written to the terminal), and the "blocked" writer process will be free to resume.

For some more information, see Bash FAQ #85.

NamedPipes (last edited 2012-07-21 09:01:02 by 77)