Inter-process communication, how? Part 2

ecir.hana at gmail.com ecir.hana at gmail.com
Sun Dec 23 06:50:15 EST 2007


On Dec 23, 10:30 am, "Guilherme Polo" <ggp... at gmail.com> wrote:
> 2007/12/22, ecir.h... at gmail.com <ecir.h... at gmail.com>:
>
> > Hello,
>
> > just to recap: last time I asked how to do an interprocess
> > communitation, between one Manager process (graphical beckend) and
> > some Worker processes.
>
> > I decided to go with sockets, thanks for replies, once more.
>
> > However, I would like to ask another thing: I would like to collect
> > everyting what the Workers print and display in Manager. Or, redirect
> > all Workers' stdout to stdio of Manager. If there was only one Worker
> > I could use a pipe, right? But if there are more than one Worker, what
> > to do? I found something called "named pipe" which seems rather
> > complicated.
>
> Named pipe is called FIFO, but they are not that complicated.
>
> > Then I thought I could somehow (how?) create a fake
> > (virtual) file object,
>
> That is why it is called named pipe, because you will be using a
> (especial) file in your filesystem to use as a pipe.
>
>
>
> > redirect stdout of a Worket into it and from
> > there send the data to Manager via sockets. Please, what do you think?
>
> > Preferably, it should look like this:
>
> > --- Worker 1 ---
> > ...some code...
> > print '123'
>
> > --- Manager ---
> > Worker 1: 123
>
> > --- Worker 2 ---
> > ...some code...
> > print '456'
>
> > --- Manager ---
> > Worker 1: 123
> > Worker 2: 456
>
> > Thanks in advance!
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> Manager would create and open the FIFO, Workers would open this same
> FIFO. So workers write to FIFO and the manager reads from FIFO.
>
> --
> -- Guilherme H. Polo Goncalves

What I don't like about FIFO, is that on Unix they are persistent
files. So whatever happens to Manager they would stay there...
I was just wondering if there's another way of doing the above and if
not, I would probably go with FIFO. Thanks!



More information about the Python-list mailing list