Re: Sharing readonly data between processes
[prev]
[thread]
[next]
[Date index for 2005/01/10]
Tom Schindl wrote:
> Loading/Parsing the XML before Apache forks its children and not
> modifying the data from this point on all apache/mp children will share
> the same data and it would not be copyied to each of them, copying only
> takes place when the data is modified. Is this true or have I got
> something wrong.
It's mostly true, but an XML object is usually something complex which
may alter data in some way when you call methods to read it. Even
reading a variable as a string when it had previously only been read as
a number causes a write in perl. It doesn't unshare the entire thing
when that happens, but you do lose in 4K chunks (or whatever the page
size is on your OS).
> 2.
> Is this also true when running e.g. under a thread mpm on mod_perl2,
> e.g. when you are on windows?
No, there is no equivalent copy-on-write concept with threads on
Windows. There you would have to declare it shared between threads,
which has catches with objects and may not be safe with this module.
Read the threads man pages for more.
- Perrin
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.9 - Release Date: 1/6/2005
 |
 |
Re: Sharing readonly data between processes
Perrin Harkins 03:44 on 10 Jan 2005
|