- A call to pipe creates file descriptors, which are valid only within that process and its children.
- A process's file descriptors cannot be passed to unrelated processes; however, when the process calls fork, file descriptors are copied to the new child process. Thus, pipes can connect only related processes.
- In the following http://siber.cankaya.edu.tr/SystemsProgramming/cfiles/pipe.cprogram, (see Fig. 1.4.1) a fork spawns a child process. The child inherits the pipe file descriptors. The parent writes a string to the pipe, and the child reads it out.
Figure 10:
Using a Pipe to Communicate with a Child Process
|
2006-03-31