Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8337919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:25:58+00:00 2026-06-09T04:25:58+00:00

I have a parent process which spawns a certain number of child processes. Those

  • 0

I have a parent process which spawns a certain number of child processes. Those child processes do some work and send the parent a message with the results via a interprocess message queue. However, I would also like the child processes to wait for the parent process to send them an acknowledgement that the message has been properly received and processed, and terminate only after receiving such a signal from the parent.

Right now, the code looks more or less like this :

parent                      child
spawn process
wait for message            do processing
                            send message
receive message             wait on condvar
save the message
notify the condvar          resume execution
wait for child termination  terminate

Which, of course, leads to a deadlock if the parent does the notify on the condvar before the child even begins to wait on it – if that happens, then the parent waits for the child to exit, and the child waits for a signal on the condition variable.

So, my question is : how to ensure that the child always executes wait in the first place, that is before the parent executes notify? Or am I going about the whole problem completely wrong?

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:26:00+00:00Added an answer on June 9, 2026 at 4:26 am

    Use an inter-process named semaphore or event – something that holds state, so that even if the parent signals before the child is waiting, the signal will still be received.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On OS X 10.4/5/6: I have a parent process which spawns a child. I
I have a application which forks a child process. Child process does some work
I have a child process which generates some output of variable length and then
Suppose I have a process which spawns exactly one child process. Now when the
I have a child process which runs in a pseudo terminal. The parent process
I have a parent process which forks out a child to perform execv(). I
I am currently trying to communicate a parent process which should have multiple children
I have a parent and a child process written in C language. Somewhere in
I have a parent class which contains a child object. I am using set
I have a parent and child process, and the parent can read output from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.