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? Perhaps some kind of caching implementation is more along the lines I'm thinking on? > 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? I think I should have said process start up, for example a long running process that can supply the object to new ones, loaded on webserver start up. I appreciate comments, It is purely so I can understand python and program design better. Regards, Mike On Feb 1, 2008 12:09 AM, Steve Holden <[EMAIL PROTECTED]> wrote: > Mike D wrote: > > Hello, I've just picked up the Python language and am really enjoying > it. > > > > 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? > > > 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 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. > > > > If anyone could give me some advice or point me in the correct direction > > I'd really appreciate it. > > > > Thanks in advance, > > > 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. > > 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