Re: Sharing readonly data between processes
[prev]
[thread]
[next]
[Date index for 2005/01/10]
Thanks Perrin your answers are as I suspected.
Tom
Perrin Harkins wrote:
> 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
>
>