python threads
Ype Kingma
ykingma at accessforall.nl
Sat Dec 22 15:00:29 EST 2001
curt finch wrote:
>
> We ship a web application completely written in python.
>
> The application server daemon that sits between apache/IIS and the
> dbserver would like to take advantage of multi-chip architectures
> and have many threads. Each thread would be owned by a logged
> in user with it's own db connection and share cached db data with
> other threads.
I assume you select on sockets.
>
> My understanding is that python's current threads implementation
> does not really allow for this in the sense that only one thread
> can be running at a time, regardless of the number of chips on
> the machine, and additionally that the threads cannot really
> interrupt each other and still maintain correct state.
>
> Is that all correct?
>
It is correct for CPython, as others explained.
It is not correct for Jython. which uses java threads.
You might consider porting to Jython in case you have the
non blocking I/O in java available (java 1.4 iirc).
This will require a rewrite of the socket and socket select
using code on top of java's non blocking I/O package,
so it might not be feasible now.
Perhaps someone from Zope has some experience doing this...
Regards,
Ype
More information about the Python-list
mailing list