Named pipe
≈ 3 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
In computing, a named pipe (also known as a FIFO for its behavior) is an extension of the traditional pipe concept on Unix and Unix-like systems, and is one of the methods of inter-process communication (IPC). The concept is also found in the OS/2 and Microsoft Windows operating systems, although the programming semantics differ substantially. A traditional pipe is "unnamed" and lasts only as long as the process. A named pipe, on the other hand, can last as long as the system is up, beyond the life of the process, and can be deleted if no longer used. Usually a named pipe appears as a file, and generally processes attach to it for inter-process communication (IPC).
In computing, a named pipe (also known as a FIFO for its behavior) is an extension of the traditional pipe concept on Unix and Unix-like systems, and is one of the methods of inter-process communication (IPC). The concept is also found in the OS/2 and Microsoft Windows operating systems, although the programming semantics differ substantially. A traditional pipe is "unnamed" and lasts only as long as the process. A named pipe, on the other hand, can last as long as the system is up, beyond the life of the process, and can be deleted if no longer used. Usually a named pipe appears as a file, and generally processes attach to it for inter-process communication (IPC). mkfifo my_pipe gzip -9 -c out.gz & In a separate process, independently, one could send the data to be compressed: cat file > my_pipe At the point the second shell opens for writing in the process that will run , the read-only opening by the first shell is unblocked and both and are then executed concurrently one feeding data to the other through the pipe. The named pipe can be deleted just like any file: rm my_pipe A named pipe can be used to transfer information from one application to another without the use of an intermediary temporary file. For example, you can pipe the output of gzip into a named pipe (here out.gz is from above example but it can be any gz): mkfifo -m 0666 /tmp/namedPipe gzip -d /tmp/namedPipe Then load the data being decompressed on the fly into a MySQL table like so: LOAD DATA INFILE '/tmp/namedPipe' INTO TABLE tableName; Without this named pipe, one would need to write out the entire uncompressed version of file.gz before loading it into MySQL. Writing the temporary file is time-consuming, and results in more I/O usage and less free space on the hard drive. PostgreSQL's command line utility, psql , also supports loading data from named pipes.
References
External links
Linux Interprocess Communications: Named Pipes (Linux Documentation Project, 1996) Introduction to Named Pipes (Linux Journal, 1997)
Text derived from https://en.wikipedia.org/w/index.php?oldid=1378133844 under CC BY-SA 4.0; modifications have been made.