Pipe Concepts: Communication between Processes

Sometimes, the processes the user runs have nothing to do with each other, but the ability to exchange information among processes sometimes produces a synergistic effect when their cooperation makes it possible to perform tasks neither program could manage alone. For example, a phone dialer and a paint program probably have little in common but, if we wanted the paint program to dial a remote connection to transfer information, a link to a phone dialer would make perfect sense. Windows 98 allows many channels of communication, including the clipboard, DDE, OLE, and other channels. In Chapter 19, for example, you’ll see how processes can share memory by opening views onto the same memory-mapped file.

Pipes are an easy mechanism for different programs to exchange information. Unlike some other channels, pipes have no formal standards or protocols to govern how information is passed. That makes pipes easier to use and more flexible than, say, DDE conversations, but it also limits them to programs that recognize each other and know how to parse the information they agree to exchange.

TIP

The use of pipes was originally introduced under Windows NT and later supported by Windows 95, then Windows 98 in the form of anonymous pipes. However, only Windows NT supports the use of named pipes; these are not supported by Windows 98.

A pipe is a section of shared memory where processes leave messages for each other. A pipe resembles a file where one program writes and another reads. Because a pipe is dedicated to interprocess communication, the Win32 API can provide a range of commands to facilitate the exchange of information. Conceptually, a pipe is a cross between a computer file and a post office mailslot. One process writes something in the file, and another process looks to see what was left behind.

© 1998 SYBEX Inc. All rights reserved.