[OT] Re: Module address space
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Graham Dumpleton wrote: > Strictly speaking it is more complicated that my simple answer > indicates and I in part tried to suggest that there was more to it > than that. The main thrust of my simple answers was to make clear that [...] Graham, I just want to state that your answers were definitely clear, and that they also helped me! :) - -- Arturo "Buanzo" Busleiman - Consultor Independiente en Seguridad Informatica OpenPGP for HTTP: New Web-Auth Scheme: http://freshmeat.net/articles/view/2599 Consulting and Secure Mail Hosting: http://www.buanzo.com.ar/pro/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGVL+DAlpOsGhXcE0RChCFAJ0ZnQE4g6xWA0cUmuCBtwBRvkiOxACfW3rK o4oYufcAossB/cG7F3ejtGw= =Uhmt -END PGP SIGNATURE-
Re: Module address space
On 23/05/07, Ralf Mattes <[EMAIL PROTECTED]> wrote: On Wed, 2007-05-23 at 09:24 +1000, Graham Dumpleton wrote: > On 23/05/07, César Leonardo Blum Silveira <[EMAIL PROTECTED]> wrote: > > Hello all, > > > > I have some questions about handling data within modules. I will try > > to be as clear as possible. > > > > 1) Each module is loaded once per server, right? > > Yes, although there is a bit more to it than that when you consider restarts. Strange - i thought modules wuold be loaded _twice_ (once to enshure configuration consitency and once to use them ...) Strictly speaking it is more complicated that my simple answer indicates and I in part tried to suggest that there was more to it than that. The main thrust of my simple answers was to make clear that the loading occurs in the main Apache process and doesn't happen again in the child processes but that they inherit the loaded module. But then, even this isn't strictly true on Windows and only applies to UNIX. To really understand it all properly that is where the referenced documentation is good to read. It is easier to point people to that than spend a long time in mail trying to explain all the twists and turns. :-) Graham
Re: Module address space
Graham, Thank you! Now things are a lot more clear to me :-) -- César L. B. Silveira http://cesarbs.wordpress.com/ On 5/22/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: On 23/05/07, César Leonardo Blum Silveira <[EMAIL PROTECTED]> wrote: > Hello all, > > I have some questions about handling data within modules. I will try > to be as clear as possible. > > 1) Each module is loaded once per server, right? Yes, although there is a bit more to it than that when you consider restarts. > In which processes address space is it loaded? The initial Apache parent process. It is then inherited by the Apache child processes when they are forked off from the parent. > 2) Suppose I have a global variable in a module. Using the prefork > MPM, will all processes see the updated value all the time, or will > each process have a separate value for the global variable? Each Apache child process will have their own copy and writing to it will only affect that processes copy. Ie., other processes will not see an update. > 3) If I want to have an apr_table_t in my module config structure, is > there any way to share it between the Apache processes (again, suppose > that I'm using the prefork MPM)? Not an actual apr_table_t instance as such. To share data between processes you would need to use shared memory or something equivalent. Placing more complicated data structures in shared memory can though be more tricky though than simple data variables. Apache itself uses what it calls the scoreboard for communicating information between processes, in effect a wrapper around a shared memory mechanism. FWIW, you might want to read through: http://www.fmc-modeling.org/projects/apache/html/Apache_Modeling_Project.html It explains more about how modules are loaded into Apache, how child processes are created and managed, how Apache uses the scoreboard mechanism etc. It is quite technical and in depth though so may be more than what you want to know. Graham
Re: Module address space
On Wed, 2007-05-23 at 09:24 +1000, Graham Dumpleton wrote: > On 23/05/07, César Leonardo Blum Silveira <[EMAIL PROTECTED]> wrote: > > Hello all, > > > > I have some questions about handling data within modules. I will try > > to be as clear as possible. > > > > 1) Each module is loaded once per server, right? > > Yes, although there is a bit more to it than that when you consider restarts. Strange - i thought modules wuold be loaded _twice_ (once to enshure configuration consitency and once to use them ...) Cheers, RalfD
Re: Module address space
On 23/05/07, César Leonardo Blum Silveira <[EMAIL PROTECTED]> wrote: Hello all, I have some questions about handling data within modules. I will try to be as clear as possible. 1) Each module is loaded once per server, right? Yes, although there is a bit more to it than that when you consider restarts. In which processes address space is it loaded? The initial Apache parent process. It is then inherited by the Apache child processes when they are forked off from the parent. 2) Suppose I have a global variable in a module. Using the prefork MPM, will all processes see the updated value all the time, or will each process have a separate value for the global variable? Each Apache child process will have their own copy and writing to it will only affect that processes copy. Ie., other processes will not see an update. 3) If I want to have an apr_table_t in my module config structure, is there any way to share it between the Apache processes (again, suppose that I'm using the prefork MPM)? Not an actual apr_table_t instance as such. To share data between processes you would need to use shared memory or something equivalent. Placing more complicated data structures in shared memory can though be more tricky though than simple data variables. Apache itself uses what it calls the scoreboard for communicating information between processes, in effect a wrapper around a shared memory mechanism. FWIW, you might want to read through: http://www.fmc-modeling.org/projects/apache/html/Apache_Modeling_Project.html It explains more about how modules are loaded into Apache, how child processes are created and managed, how Apache uses the scoreboard mechanism etc. It is quite technical and in depth though so may be more than what you want to know. Graham
Module address space
Hello all, I have some questions about handling data within modules. I will try to be as clear as possible. 1) Each module is loaded once per server, right? In which processes address space is it loaded? 2) Suppose I have a global variable in a module. Using the prefork MPM, will all processes see the updated value all the time, or will each process have a separate value for the global variable? 3) If I want to have an apr_table_t in my module config structure, is there any way to share it between the Apache processes (again, suppose that I'm using the prefork MPM)? Thank you in advance, -- César L. B. Silveira http://cesarbs.wordpress.com/