Pass data to a subprocess

Laszlo Nagy gandalf at shopzeus.com
Wed Aug 1 10:32:04 EDT 2012


>>> things get more tricky, because I can't use queues and pipes to
>>> communicate with a running process that it's noit my child, correct?
>>>
>> 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.



More information about the Python-list mailing list