Anonymous pipe

Anonymous pipe

In computer science, an anonymous pipe is a simplex FIFO communication 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 full-duplex (two-way) communication.

Unix

Pipelines are an important part of many Unix applications and support for them is well-integrated into most Unix-like operating systems. Pipes are created using the pipe() 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 shell a pipeline is created using the "|" character and many Unix programs are designed as filters to work with pipes.

Microsoft Windows

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 CreatePipe is 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 ReadFile and WriteFile.

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-file is 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)
* Byte-oriented IO
* Reliable
* 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 (FileRead, FileWrite)
* Inheritable handles (CreateProcess)

See also

* Named pipe
* Pipeline (Unix)

References

* Hart, Johnson M. "Windows System Programming, Third Edition." Addison-Wesley, 2005. ISBN 0-321-25619-0


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Anonymous Pipe — Die Pipe (englisch für Rohr, Röhre) bezeichnet einen gepufferten uni oder bidirektionalen Datenstrom zwischen zwei Prozessen nach dem „First In – First Out“ Prinzip. Das heißt vereinfacht, dass die Ausgabe eines Prozesses (ein Programm in… …   Deutsch Wikipedia

  • anonymous pipe — noun A simplex FIFO communication channel that may be used for one way interprocess communication. See Also: named pipe …   Wiktionary

  • Named pipe — In computing, a named pipe (also known as a FIFO for its behavior) is an extension to the traditional pipe concept on Unix and Unix like systems, and is one of the methods of inter process communication. The concept is also found in Microsoft… …   Wikipedia

  • named pipe — noun An extension to the anonymous pipe concept on Unix and Unix like systems, used for interprocess communication. See Also: anonymous pipe …   Wiktionary

  • Pipeline (Unix) — In Unix like computer operating systems, a pipeline is the original software pipeline : a set of processes chained by their standard streams, so that the output of each process ( stdout ) feeds directly as input ( stdin ) of the next one. Each… …   Wikipedia

  • Inter-process communication — For other uses, see IPC. In computing, Inter process communication (IPC) is a set of methods for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC… …   Wikipedia

  • mmap — In computing, mmap is a POSIX compliant Unix system call that maps files or devices into memory. It is a method of memory mapped file I/O. It naturally implements demand paging, because initially file contents are not entirely read from disk and… …   Wikipedia

  • Именованный канал — …   Википедия

  • Internet socket — In computer networking, an Internet socket or network socket is an endpoint of a bidirectional inter process communication flow across an Internet Protocol based computer network, such as the Internet. The term Internet sockets is also used as a… …   Wikipedia

  • Message queue — In computer science, message queues and mailboxes are software engineering components used for interprocess communication, or for inter thread communication within the same process. They use a queue for messaging – the passing of control or of… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”