Design question - Sharing of single object by multiple processes
Mike D
42flicks at gmail.com
Thu Jan 31 17:23:50 EST 2008
Steve,
You raise some very good (and obvious) issues I did'nt consider. I'll look
further into this sort of implementation as I'm quite interested.
I suppose a compromise could be to load the objects from a pickle, that may
have issues in terms of updating the pickle perhaps, though it would be much
safer.
I'll continue to investigate, thanks for your input.
On Feb 1, 2008 11:00 AM, Steve Holden <steve at holdenweb.com> wrote:
> Mike D wrote:
> > Steve,
> >
> > Thanks for the response. My question really comes down to, as you
> > suggested, premature optimization.
> >
> > It is more for my own understanding than a current practical use.
> >
> > If an object is loaded into memory and other threads(or processes) can
> > recieve a pointer to this location, would this not be more efficient
> > than to load a new one for every unique request? Wouldn't a method such
> > as this prevent bottle necks in a read heavy environment?
> >
> In theory, yes. In practice there are problems, since modern operating
> systems are explicitly designed to place barriers between the address
> spaces of different processes.
>
> Even supposing you could access another Python process's space freely
> you would then have issues like:
> * does a reference from a foreign process add to an
> object's reference count?
> * if so, what happens if the foreign process terminates
> without decrementing the reference count
> * otherwise waht happens if the owning process disposes of
> the object while the foreign process stil wants to refer
> to it.
>
> I don't wish to be unkind, but these are well-known issues of
> inter-process information sharing, and while superficial solutions can
> seem easy, the more you think about and work on them the more obvious it
> becomes that these are hard problems in the general case.
>
> Which will hopefully at least encourage you that you are addressing the
> real issues of computing, even though there's a lot to do.
>
> > [...]
>
> regards
> Steve
> --
> Steve Holden +1 571 484 6266 +1 800 494 3119
> Holden Web LLC http://www.holdenweb.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080201/e9229ae9/attachment.html>
More information about the Python-list
mailing list