Pass data to a subprocess

Laszlo Nagy gandalf at shopzeus.com
Wed Aug 1 10:42:44 EDT 2012


>>> Yes, I think that is correct.
>> I don't understand why detaching a child process on Linux/Unix would
>> make IPC stop working.  Can somebody explain?
>>
> It is implemented with shared memory. I think (although I'm not 100% 
> sure) that shared memory is created *and freed up* (shm_unlink() 
> system call) by the parent process. It makes sense, because the child 
> processes will surely die with the parent. If you detach a child 
> process, then it won't be killed with its original parent. But the 
> shared memory will be freed by the original parent process anyway. I 
> suspect that the child that has mapped that shared memory segment will 
> try to access a freed up resource, do a segfault or something similar.
So detaching the child process will not make IPC stop working. But 
exiting from the original parent process will. (And why else would you 
detach the child?)




More information about the Python-list mailing list