- Anonymous pipe
computer science, an anonymous pipe is a simplex FIFOcommunication channel that may be used for one-way interprocess communication. An implementation is often integrated into the operating system's file IO subsystem. Typically a parent program opens anonymous pipes, and creates a new process that inherits the other ends of the pipes, or creates several new processes and arranges them in a pipeline.
Two anonymous pipes are required for
Pipelines are an important part of many
Unixapplications and support for them is well-integrated into most Unix-likeoperating systems. Pipes are created using the
system call, which creates a new pipe and returns a pair of file descriptors referring to the read and write ends of the pipe. In a Unix shella pipeline is created using the "|" character and many Unix programs are designed as filters to work with pipes.
Like many other device IO and IPC facilities in the
Microsoft Windows Win32 API, anonymous pipes are created and configured with API functions specific to the IO facility. In this case
CreatePipeis used to create an anonymous pipe with separate handles for the read and write ends of the pipe. Read and write IO operations on the pipe may use the standard IO facility API functions
On Microsoft Windows, reads and writes to anonymous pipes are always blocking. In other words, a read from an empty pipe will block in the call until either one or more bytes arrive, or the pipe is closed and an
end-of-fileis sent. Likewise, a write to a full pipe will block in the call until space becomes available to store the data being written. Reads may return with fewer than the number of bytes requested, otherwise known as a short-read.
New processes may inherit handles to anonymous pipes in the creation process. The new process simply needs a way of identifying the handle that it inherited.
Summary of anonymous pipes on Microsoft Windows:
* Intramachine IPC only
* Simplex (one-way)
* Read and write always blocking
* Short-Read (successful reads may return less than the number of bytes requested) (Is also short-write?)
* Standard device IO handles (
* Inheritable handles (
* Hart, Johnson M. "Windows System Programming, Third Edition." Addison-Wesley, 2005. ISBN 0-321-25619-0
Wikimedia Foundation. 2010.