Embedding and threads ?
Bo Lorentsen
bl at netgroup.dk
Wed Jun 12 04:23:59 EDT 2002
On Mon, 2002-06-10 at 23:43, Kragen Sitaker wrote:
> > I will use Python for this project as long as what I do only need a
> > single thread model, and when I need more than that I'll se what to do
> > about it :-)
>
> It sounds like you want processes, not threads. Assuming you're not
> on Microsoft Windows, os.fork() will give you one Python interpreter
> state per process. Different processes have to make special
> arrangements to communicate, though, through explicitly shared memory
> or explicit channels.
Yes, I use thread somehow like processes, but I like to be able to share
recources between them, more easily (cache, db, sockets etc.).
A process gives me a total copy of myself, where a thread only make a
new stack, but share data. I know I can transfere file (and socket)
handlers while using processes, but the thread model is much more
elegant.
/BL
More information about the Python-list
mailing list