Named pipes on Unix edit
Adapted (read; ripped with some minor editing) from a Linux man-page: pipe (7)Pipes and FIFOs (also known as named pipes) provide a unidirectional interprocess communication channel. A pipe has a read end and a write end. Data written to the write end of a pipe can be read from the read end of the pipe.
A FIFO (short for First In First Out) has a name within the file system, and is opened as a regular file. Any process may open a FIFO, assuming the file permissions allow it, and may then read or write to it as appropriate.
I/O on Pipes and FIFOs
The only difference between pipes and FIFOs is the manner in which they are created and opened. Once these tasks have been accomplished, I/O on pipes and FIFOs has exactly the same semantics.
The communication channel provided by a pipe is a byte stream: there is no concept of message boundaries.
Pipe Capacity
A pipe has a limited capacity. If the pipe is full, then a write will block or fail, depending on whether the pipe was opened in non-blocking mode. Different implementations have different limits for the pipe capacity. Applications should not rely on a particular capacity: an application should be designed so that a reading process consumes data as soon as it is available, so that a writing process does not remain blocked.
In Linux versions before 2.6.11, the capacity of a pipe was the same as the system page size (e.g., 4096 bytes on x86). Since Linux 2.6.11, the pipe capacity is 65536 bytes.
Portability notes
On some systems (but not Linux), pipes are bidirectional: data can be transmitted in both directions between the pipe ends. According to POSIX.1, pipes only need to be unidirectional. Portable applications should avoid reliance on bidirectional pipe semantics.
Named pipes on Windows edit
Windows also supports named pipes, albeit with different semantics.
TWAPI provides commands [
1] for communicating over named pipes from Tcl.
Named pipes on Clusenix edit
See also: edit