I have read sections in W. Richard Stevens' book APUE and my conclusion is that unix does
handle sharing of read-only files fine. The problem with sharing files arises only when writing is involved which usually requires atomic operations. Of course, database handlers are totally different kind of beast and is not of concern here.
 
So I think it is safe and reliable to share a read-only file opened in the parent modperl process amongst all modperl processes, at least on the unix systems which concerns me here.
 
Thanks
 
Richard


Gedanken <[EMAIL PROTECTED]> wrote:
On Tue, 15 Feb 2005, Richard Chen wrote:

Im a big fan of reading read-only data files, config files, etc at server
start up in startup.pl and sharing between children. There could easily
be problems with my approach and i welcome the criticism =)

The only time I have been burned with parent-child sharing is with
database handles in forked processes. you have to jump through hoops with
mysql/dbi or else all kinds of corruption occurs when the child uses the
handle created in the parent.

mfp


Hi,

I recall that in general it is not a good idea to open
a file in the parent modperl process and then share it
among the child modperl processes. One should open the
file separately in each of the child processes. But what
if the file is used just for read-only access? Is it still
necessary to open the file separately in the child
processes? It seems to be more efficient to share if it
can be done reliably.

The practical-modperl book gives an example showing
how to open a read-only dbm file from child init handler
in each of the child process. But there is no rational given.

For the few tests I have done using MLDBM, opening the
file in the parent process and then sharing that among
the child processes seems to work fine. But I would like to know
if there are any potential problems associated with this practice.

Thanks for any info.

Richard Chen



---------------------------------
Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'

--
gedanken


Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'

Reply via email to