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:

  1. Parent creates a process and waits using sigsuspend.
  2. Child creates a process.
  3. Grandchild performs an execvp and gets some information using snmp and sends this information to child using a pipe.
  4. Child gets grandchild's output and parses the useful information, placing it in a shared memory space with parent.
  5. Child signals parent to wake up. Child repeats from 2.
  6. 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

4 Years
Discussion Span
Last Post by I_m_rude

Problem solved, there was a segmentation fault in the child process when trying to access the shared memory space.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.