[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: Design question - Sharing of single object by multiple processes

Steve Holden

1/31/2008 10:01:00 PM

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.hold...