On Jan 20, 2011, at 5:42 PM, Massimo Manghi wrote: > A fork call copies data, stack and heap from the parent to the child process, > so in principle an interpreter state could be copied into the new process > (text pages are shared). What is missing in this picture for having a real > cloning?
I've looked at this a little further. I think we would create the parent interpreter in the httpd parent process in Rivet_InitHandler(), which is invoked during http initialization because it was passed to ap_hook_post_config() by rivet_register_hooks(). At this point, the interpreter in the parent httpd process, we'd initialize it with the normal Tcl_Init-type stuff and then execute any global init scripts. Again, this all happens within Rivet_InitHandler when there is only the one httpd process running. As the parent process forks off all the httpd children, each child has Rivet_ChildInit() called, as before, because Rivet_ChildInit was passed to ap_hook_child_init() by rivet_register_hooks(). Rivet_ChildInit() would be modified to use the interpreter created by Rivet_InitHandler(), unless separate virtual interpreters was defined, and then instead of doing all that interpreter creation stuff in Rivet_InitTclStuff(), like it does now, it would do the Apache stuff it needs to do and also execute the child init scripts on the interpreter it inherited from the parent when the parent forked it off. Per-page processing would continue unmodified. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
