Re: Design question - Sharing of single object by multiple processes
- From: Steve Holden <steve@xxxxxxxxxxxxx>
- Date: Thu, 31 Jan 2008 06:09:21 -0500
Mike D wrote:
Hello, I've just picked up the Python language and am really enjoying it.First there's the problem of having multiple processes access any kind of shared resource. So your question makes me wonder whether you mean processes, or threads. Are you *sure* you mean processes?
I've just signed up to this mailing list and I'm looking forward to taking part in some discussions.
My first post is a question I've been pondering for the last couple of days:
For relatively static data (such as a list), is it possible to load a single instance and have many python processes access it?
I want to have an object in memory. This object will be loaded on application start up and will contain a list of objects. These will be obtained from (most likely) the file system.So "application startup" is different from "process startup"? Your application is a group of co-operating processes? Really?
My reasoning is: I want to prevent a file system or database fetch each time as it seems unnecessary.It might also seem unnecessary to start the Python interpreter for each process, but you are going to have to ...
Is this possible? In Java I'm pretty sure this could implemented with an object factory and static methods. My understanding is that python invokes a separate process for each request however.Your understanding is clearly informed by some information you have omitted to share with us.
If possible, what would be a good way of providing a new structure as it is updated.More answers, please. There are mechanisms such as Pyro (Python remote objects) that allow inter-process method calls, but I am far from convinced that's what you really want (or need, anyway). Perhaps yo could let us know a little more about what it really is you are trying to do, and convince me, at least, that this isn't just a case of premature optimization.
If anyone could give me some advice or point me in the correct direction I'd really appreciate it.
Thanks in advance,
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
.
- Prev by Date: dl module
- Next by Date: Re: REALLY simple xml reader
- Previous by thread: dl module
- Next by thread: Re: Design question - Sharing of single object by multiple processes
- Index(es):
Relevant Pages
|