Re^3: Perl forked processes and variable sharingby dave_the_m (Monsignor)
|on Feb 02, 2022 at 07:44 UTC
I still don't really follow what point you're trying to make, but you don't seem to get getting how forking and virtual memory works.
Consider a process which uses two int/pointer sized memory locations. One contains a value, and the second contains a pointer to the first:
Those are virtual addresses - those are the addresses the process sees, and which are printed out in things like SCALAR(0x10000). The CPU's hardware behind the scenes maps that page of address space for that process to some physical page in RAM. This is all behind the scenes - you never get to see physical addresses. After the fork, the child process gets a *copy* of the parents address space - same virtual address locations, but mapping to a different physical page of memory which contains a copy of the values:
After the child modifies the value, you get this:
There is absolutely no connection between the parent and child aside from the fact that initially the child's value in its memory is a copy of the parent's. If you think your code shows shows something else, please say which exact line of output shows this, and what you think its output should be.