[Pntool-developers] SF.net SVN: pntool:[240] codegen/supervisor_algorithm.txt
Brought to you by:
compaqdrew,
miordache
From: <com...@us...> - 2009-08-23 07:45:37
|
Revision: 240 http://pntool.svn.sourceforge.net/pntool/?rev=240&view=rev Author: compaqdrew Date: 2009-08-23 07:45:30 +0000 (Sun, 23 Aug 2009) Log Message: ----------- pipes description Modified Paths: -------------- codegen/supervisor_algorithm.txt Modified: codegen/supervisor_algorithm.txt =================================================================== --- codegen/supervisor_algorithm.txt 2009-08-23 07:45:26 UTC (rev 239) +++ codegen/supervisor_algorithm.txt 2009-08-23 07:45:30 UTC (rev 240) @@ -4,3 +4,11 @@ An array of plant names is serialized. The supervisor must know at run-time which plant executables to run. +RUN-TIME + +Four file descriptors are created for each child. There is a pipe (READ_END and WRITE-END files) *to* the child, and likewise *from* the child. The supervisor has READ_END for the "from" pipe and WRITE_END for the "to" pipe, while the child process has the opposite ends/file descriptors for the respective pipes. + +Since the processes are created with fork/exec, it's important to close file descriptors that are not needed by the process. For instance, on 491-499 of supervisor_static_include.h, the parent process closes the ends of the pipe that have been handed to the child. If the parent did not close these ends, the pipes would not flush properly. Likewise, the child must close its existing STDIN and STDOUT, as well as any pipe-ends it has inherited from the parent process during the exec. As a side note, file descriptor numbers are preserved across exec for posix platforms, so debug output from different processes should agree, which can assist in debugging pipe issues. + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |