A named pipe is a pipe, except that it is named. As a result, it is necessary to first explain what a pipe is.
A “pipe” in systems programming is also called a FIFO, or first-in-first-out. It is an association of the stdout (standard out, known as cout in C++) file of one process to the stdin (standard in, known as cin in C++) file of another process. As such, it makes it possible for the result of “cout << ...” of one program to get to the “cin >> ...” of another program.
Without a name, a pipe can only be created by the shell of an OS. For example, the command “ls -R / | less” creates a pipe to connect the output of “ls -R /” (recursively list all files and directories from the root directory) to the input of less (use a pager to display text content page by page). In this case, the pipe has no name, and does not has a vnode representation. Furthermore, this kind of pipe ceases to exist when either program closes either stdin or stdout.
A named pipe, on the other hand, can be created without being attached to any program. The mkfifo command is used to create a named pipe. After its creation, a named pipe has an associated vnode in the containing directory, but remains unattached to the stdin or stdout of any program.
It is only until a named pipe is specified as a file used by a program that it becomes attached. Interestingly, a named pipe can be opened for writing by any number of processes, and likewise for reading. Although the simultaneous read option makes sense, it is generally not a good idea to have multiple concurrent processes writing to a named pipe, as the result will be interleaved without any specific organization.
A named pipe does not cease to exist when a process that opened it closes it, and this applies to both the writing end and the reading end.