Stas Bekman wrote:

Thomas Schindl wrote:

When running with mp2 and worker mpm the case is slightly different:
1. Apache-starts and starts Apache-Child 1 which spawn Thread 1.1 and Thread
1.2 and Apache-Child 2 which spawn Thread 2.1 and Thread 2.2
2. User1 hits Apache-Child 1 Thread 1.1 and sets the global $FOO from 0 to 1
which is shared between the threads
3. User2
3.a. hits Apache-Child 1 Thread 1.2 $FOO is 1 because User1 has set $FOO to
1
3.b. hits Apache-Child 2 Thread 2.1 or Thread 2.2 $FOO is 0 because User1
has set $FOO to 1 in thread 1.1 and 1.2.


That explanations serves as a good answer to the question. But...

That's not what happens behind the scenes.

- Apache threads have nothing to do with perl interpreters.

- There is no 1:1 relationship between apache threads and perl interpreters. Inside one child process you can have 1 Apache thread, and 10 perl interpreters, and vice versa, 10 Apache threads and 1 perl interpreter.
- Moreover, since interpreters live in pools, you can have several pools
comprised of totally different/unrelated interpreters.
- And all these could be used by Thread 1.1 if you are running under threaded apache.


So one needs to talk about perl interpreters and not Apache threads. I hope it is not too confusing :) One day someone will chart the details for a better visual comprehension.

In fact you can have perl interpreter pools with prefork-mpm too (because threads aren't relevant here at all). This feature, for example, allows two different developers use the same server with a totally different @INC. http://perl.apache.org/docs/2.0/user/config/config.html#C_Parent_



Thanks Stas for the full explaination. Indeed I didn't know exactly what's really going on behind the scences. Thanks for your explaination I'm always learning something new when reading your answers.
Still on the one hand I recognize what you're trying to tell me, on the other hand could you give me more information about how things like this could be accomplished or better the other wayround how could I prevent things like 1 thread with 10 perl-interpreters and vice versa if I don't want it?


Tom

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to