High-performance programming techniques on Linux and Windows: Pipes

32

Author: JT Smith

From an article at IBM’s developerWorks: “A pipe is an interprocess communication mechanism available on both Windows and Linux (and UNIX). Pipes originally appeared
in the Bell Laboratories version of UNIX and have remained in all UNIXes and Linux since their inception. A pipe is a stream of
bytes accessed through normal IO interfaces. It is created, and then written to or read from using whatever read or write IO system
calls are available on the operating system. In the UNIX and Linux case, the IO calls are read() and write(). In the
Windows world, the APIs are ReadFile() and WriteFile(). Windows pipes differ from Linux pipes in that a single handle
(analogous to a Linux file descriptor) supports bi-directional IO. Linux pipes return two file descriptors to effect bi-directional IO.”