David A. Nedzel
6.033 ~V Computer Systems Engineering
Section: TR12, M Rinard
Due: February 23, 2006

How the Direction of Data Flow Limits the Utility of UNIX Pipes

The UNIX time-sharing system controls how multiple processes execute on a single shared processor. While these processes may execute separately, many are related to each other and often share data. Processes can communicate and share data in a number of ways ~V piping is one such method. Unfortunately, UNIX pipes have multiple limitations which reduce their utility to developers; one limitation of particular significance is the direction of data flow in pipes.

Most of today~Rs software packages involve large numbers of smaller software components which connect together in intricate ways. The inherent data flow limitation of pipes arises from their linear nature. Pipes allow one process to call another and pass along data to it, but the newly created child process cannot return data to its parent process through the same pipe. For example, after a bank computer has calculated how much interest a customer has earned on an account, the interest calculating process might call another process to actually initiate the transfer of funds, passing along data such as the account number and the amount of interest earned.

Pipes can work well for processes which run in sequence, as they did in the bank example; however, the one-way dataflow limitation becomes debilitating for programs which have simultaneous processes running which all must read and modify shared data. Consider an action video game such as Descent, where a player must infiltrate and destroy enemy facilities ~V naturally there are numerous obstacles to this goal. The player can choose to fire any number of weapons which behave in different ways. Enemy robots respond to the movement and behavior of the player, as well as other robots. If the behavior of each robot, weapon, etc. is considered a process, they cannot be piped together since the child process must feedback to the parent. For example, if the player bumped into a robot, the robots reaction would feedback to the player, for example, a weapon might fire.

Clearly, when processes begin running simultaneously, pipes become ineffective in sharing data appropriately between processes. Instead, other process communication methods must be used in order for multiple processes to make use of dynamic state data.