cppannotations/yo/concrete/children.yo
Frank B. Brokken dff739c87e WIP
git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@419 f6dd340e-d3f9-0310-b409-bdd246841980
2010-02-25 16:10:07 +00:00

23 lines
1.2 KiB
Text

The next step up the ladder is the construction of a child-process
monitor. Here, the parent process is responsible for all its child processes,
but it also must read their standard output. The user enters information at
the standard input of the parent process. A simple emi(command language) is
used for this:
itemization(
itt(start): this start a new child process. The parent returns the child's
ID (a number) to the user. The ID is thereupon be used to identify a
particular child process
itt(<nr> text) sends ``tt(text)'' to the child process having ID
tt(<nr>);
itt(stop <nr>) terminates the child process having ID tt(<nr>);
itt(exit) terminates the parent as well as all its child processes.
)
The child process that hasn't received text for some time will complain by
sending a message to the parent-process. Those messages are simply transmitted
to the user by copying them to the standard output stream.
A problem with programs like our monitor is that they programs allow
emi(asynchronous input) from multiple sources. Input may appear at the
standard input as well as at the input-sides of pipes. Also, multiple output
channels are used. To handle situations like these, the ti(select) system
call was developed.