[Kamailio-Devel] Fwd: question regarding fork and kamailio global variables usage

Kalpesh Rathod kalpeshrathod at gmail.com
Mon Jan 5 13:33:12 CET 2009


---------- Forwarded message ----------
From: Kalpesh Rathod <kalpeshrathod at gmail.com>
Date: Fri, Jan 2, 2009 at 6:18 PM
Subject: question regarding fork and kamailio global variables usage
To: devel at lists.kamailio.org


Hi,

I am porting kamailio to the OS which doesnt support fork. For the OS, tasks
are similar to threads of same process in Linux.

In this environment, child task(s) will share the global and heap data with
parent instead of having separate copy of the data.
Its analogus to using mutiple threads instead of multiple processes in
kamailio.

My question is , kamailio supports USE_SHM_MEM which allows all the
pkg_mallocs to become shm_malloc. This way
I dont need to be concerned about access of data in heap while porting
because code is designed that way.
Is my understanding true?

 How are the global variables accessed? especially, though data is in shared
mem, the variable holding address of data is defined as
global variable.

So,after fork parent and child both interprete global data differently or is
there any design rule enforced that after fork no.process
will be writing global data. (igonre the cleanup for a while). Will there be
any any problem if I dont give child task its own copy of
global variables and let them use the same copy as parent?

Please guide me.

Regards,
Kalpesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/devel/attachments/20090105/c759852a/attachment.htm 


More information about the Devel mailing list