Re:Global Interpreter Lock, or how to kill it
by mattgreenrocks on Thursday June 30, 2011 @12:32AM
(#2712597)
What are the uses of a process that shares address space with its parent?
[ Parent
| on HN ]
Re:Global Interpreter Lock, or how to kill it
by Someone on Friday July 01, 2011 @04:23AM
(#2717504)
I wondered, too, so I had to look this up http://cm.bell-labs.com/magic/man2html/2/fork shows that it is not the whole address space:
RFMEM If set, the child and the parent will share data and bss segments. Otherwise, the child inherits a copy of those segments. Other segment types, in particular stack segments, will be unaffected. May be set only with RFPROC.
So, it basically is a way to start a process that shares all its globals (including static variables, I think) with another process, but not other memory. That is more secure than having threads, but also more restricted, as one cannot share heap-allocated structures between such processes. I guess this feature gets used most in Fortran code where nothing gets allocated dynamically.
It also makes it easier to selective kill a thread of execution from the command line, but I do not see when that might be useful.