"This month Ed begins a series of investigations into
operating system programming interfaces, starting with pipes. He
has also added a new operating system to the lineup; Windows XP has
recently released. In this installment, Ed will be working with
pipes on Windows 2000 Advanced Server (with Service Pack 2
installed), Linux (based on Red Hat 7.1), and the newly released
Windows XP professional. Share your thoughts on this article with
the author and other readers in the discussion forum by clicking
Discuss at the top or bottom of the article.
Before we get started, please note that our nomenclature will be
slightly different now that there are two versions of Windows on
the market. I will refer to "Windows" when making no distinction
between Windows 2000 and Windows XP. When there is a distinction, I
will use "Windows 2000" or "Windows XP".
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."