This is about C in Linux.
I have fork()
in main()
where I create 2 child processes. Then, in both child process a run the function ab
If you stop to think for a minute, it would be impossible for fork
to give variables separate addresses in the parent and child process. You could already have stored the addresses anywhere in memory, or hashed them, or saved them out to a file, or anything, and then anything in the child that depended on these addresses being valid would horribly break. In fact fork
does and must create a child process in which the virtual address space is identical to the virtual address space of the parent.