I am using fork in my code. Before fork call in my code, the parent process has a global variable declared. So after the fork call does child process get a separate copy of the global variable on its own thread stack or shares the existing parent instance of global variable. so i guess there are three possibilities here 1) child process gets separate instance of global variable declared in parent process 2) child process shares the global variable with parent thread. (which is possibly not true) 3) child process doesnt have any sought of information about the global variable in parent thread
If either 2 or 3 options are true, i want to know if there is any way of getting the global variable and its "state/value at time of execution of fork()" declared in parent thread, in child process.
so broadly, is there any way of accessing parent processes variable and there states in child process created using fork().