Thanks a lot for reply. I understand it is abnormal to implement such IPC, while it is worthy for my application.
Well, my process3 and 4 are from an outside application, which both need License Check and os.system to involk. >From my experience, if Process5 involks Process3, such License Check can be very very slow (even slower than its real run). That is why I need to separate Process3 and 4 onto different processes to proceed. On Apr 28, 1:57 am, Jonathan Gardner <jgard...@jonathangardner.net> wrote: > On Apr 27, 8:59 pm, Way <csw...@gmail.com> wrote: > > > > > 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. > > Abstraction should resolve this. What I mean is that Process2 > shouldn't be defined in terms of what it actually does, but what it > appears to do. If you look at each process and think only what its > child processes do and what its parent process expects it to do, then > your job should get a lot simpler. Process1 expects Process2 to > deliver a set of parameters to spawn Process3, and then it will wait > until Process3 terminates. > > Looking at it this way, questions come to mind: Why can't Process2 run > Process3 itself? It's unusual to have one process tell another process > what to do when it can simply do it itself. > > By the way, I've never seen a time when this kind of design is > necessary. There are other ways around your problem than spawning a > bunch of processes. Each process should really be independent of all > the other processes, doing only a very well-specified task in a well- > specified way. The only time I could think of doing something like > this is when you're getting a webserver setup and Process5 needs to > communicate with Process3 to render the page or something like that. > But even in that case, each process is really independently defined > and implemented. -- http://mail.python.org/mailman/listinfo/python-list