mod_python and threads

S

skip

I'm just getting started with Myghty and using it under mod_python (also a
new beast for me). Do I have to worry about threading conflicts between
different mod_python interpreters or are they all independent?

Thx,

Skip
 
G

grahamd

Depends on what you mean exactly.

If one is on Win32 or using worker mode for Apache, the threads are
actually initially created down at the Apache level as part of a common
pool and are not bound to a specific Python interpreter. That is, two
distinct requests in time could make use of the same thread from the
common pool, but may end up calling into the context of two different
distinct Python interpreters if it happened that the URL namespace is
assigned against different interpreter instances.

The data for each Python interpreter is distinct, but if multiple
requests come in at the same time which map to the same Python
interpreter instance, then multiple threads can be operating within the
context of the same Python interpreter instance. If the two threads can
be accessing the same code/data, then you would obviously need to worry
about threading issues such as locking etc.

Anyway, you may have to be clearer about what you want to know. The
following may or may not also help.

http://www.dscpl.com.au/articles/modpython-004.html

BTW, there are bugs related to threading in mod_python 3.1.4 and
earlier. Better if you can use mod_python 3.2.5b, which gets rid of the
nastier threading issues.

Graham
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top