fifo - first-out special file, known as pipeline

Description (DESCRIPTION)

A FIFO special file (aka pipe) pipe line with similar, but it is accessed as part of the file system. It can be opened with a plurality of processes for reading and writing. When a process to exchange data through the FIFO, transmitted inside the core it will not all data written to the file system, which means that there is nothing FIFO special file in the file system, the file system entry process can be used only as a name in the file system to access a reference point of the pipeline.

Kernel maintains that there is at least one process opens the FIFO special file and only maintain a pipeline object. Before the data to the FIFO, both ends of the FIFO (read and write) must be open at the same time. Generally open will block until the FIFO the other end is also opened.

A process can open a non-blocking mode, a FIFO. In this case, even if the write end is not open, open the read end or will succeed, however, if the client does not open read, write open end will fail, and get a ENXIO (or device address does not exist).

Under Linux, either blocking or non-blocking mode, used to open a FIFO read and write will succeed. POSIX about this situation is not defined. This can be used to open the write end in the case of the read end is not open. A process at the same time and to communicate with both ends of the FIFO own time to pay special attention to prevent deadlock.

Note (NOTES)

When a process attempts to write data to the read end of the FIFO is not open when the process will receive a SIGPIPE signal. FIFO special files can be mkfifo (3) to create and ls -l will give it a special mark. 

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11082290.html