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

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

Member Avatar

what was that ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.