5 ms·
With Plan 9's rfork() (and linux's less nice clone()), you can create new processes that share the memory of the old process, which addresses those two answers.
by supersillyus 15y ago
With Plan 9's rfork() (and linux's less nice clone()), you can create new processes that share the memory of the old process, which addresses those two answers. Though, I'm not sure if this reinforces OP's point or just indicates that the distinction between threads and processes can be fuzzy.
- mattgreenrocks 15y agoWhat are the uses of a process that shares address space with its parent?
- Someone 15y agoI wondered, too, so I had to look this up http://cm.bell-labs.com/magic/man2html/2/fork 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.