Named Pipes

Although Inter Process Communication is beyond the scope of a book on filesystems, since named pipes are stored in the filesystem as a separate file type, they should be given some mention here.

A named pipe is a means by which unrelated processes can communicate. A simple example will show how this all works:

$ mkfifo mypipe
$ ls -l mypipe
prw-r--r-       1 spate      fcf                       0 Mar 13 11:29 mypipe
$ echo “Hello world” > mypipe &
[1] 2010
$ cat < mypipe
Hello world
[1]+  Done                    echo “Hello world” >mypipe

The mkfifo command makes use of the mknod() system call.

The filesystem records the fact that the file is a named pipe. However, it has no storage associated with it and other than responding to an open request, the filesystem plays no role on the IPC mechanisms of the pipe. Pipes themselves traditionally used storage in the filesystem for temporarily storing the data.

Get UNIX Filesystems: Evolution, Design, and Implementation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.