suggestion on a complicated inter-process communication
norseman at hughes.net
Tue Apr 28 18:54:27 CEST 2009
> Hello friends,
> I have a little messy situation on IPC. Please if you can, give me
> some suggestion on how to implement. Thanks a lot!
> -> denotes create
> MainProcess -> Process1 -> Process3 (from os.system)
> -> Process2 (from os.system) -> Process4 (from
> os.system) ->Process5
> I would like to make the communication between Process1 and Process5.
> Process1 needs Process5's output to provide argument to generate
> Process3, and in turn Process5 needs to wait Process3 finished.
> Thank you very much if you can give a hint.
My first reaction is to use named pipes.
Process1 -> P2 -> P4 -> Process5 >>NamedPipe (P5 outputs to NamedPipe)
Process1 waits for NamedPipe to be made and starts creating Process3
When Process3 is finished it can set an OS level environmental or
create a dummy file as a signal to Process5 to finish.
P1 becomes orchestrator, NamedPipe is courier, file is smoke signal.
This method works when IPC is not a good choice. (Like independent child
processes run across the net. A specific file in a specific location
effectively creates a specific signal. Whether or not contents are used
or even existing is programmer choice.)
Hope this helps.
More information about the Python-list