Hi, I'm trying to synchronize two processes but I get a deadlock that I can't manage to solve. To be more specific, my program has to do the following:
- Parent creates a process and waits using sigsuspend.
- Child creates a process.
- Grandchild performs an execvp and gets some information using snmp and sends this information to child using a pipe.
- Child gets grandchild's output and parses the useful information, placing it in a shared memory space with parent.
- Child signals parent to wake up. Child repeats from 2.
- When parent wakes up, writes the info to the default output and sleeps again.
But the following happens:
1. Parent creates child and sleeps.
2. Child creates grandchild, who does well gettind and sending the information back to child.
3. At a certain point, while child is parsing the information, the processor continues the parent execution, which is sleeping, and never comes back to child. So the program hangs up because the child will never signal the parent.
Any ideas of what could be happening?
Thank you