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

  • Home
  • SEARCH
  • 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 9164165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:36:58+00:00 2026-06-17T14:36:58+00:00

This is a very basic question. The parent process will create some shared memory

  • 0

This is a very basic question. The parent process will create some shared memory where it will put two integers in there, then it forked a child which will go to the shared memory and compute the sum of them. All this is fine, but how would the child inform the parent that it’s done computing the sum? Do I need to create a pipe between the two processes to do this? or waitpid() is sufficient to achieve this?

Thank you!

  • 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-17T14:36:59+00:00Added an answer on June 17, 2026 at 2:36 pm

    If your child process is no longer needed after computing the sum of your integers, it can return the sum from main and the parent process can retrieve the result using waitpid. In this case, the child would look something like this:

    Child process:

    int main(int argc, char** argv) {
        int a,b;
        /* read integers a and b from shared memory */
    
        /* return sum */
        return a + b;
    }
    

    If the child process is still needed to do further work for the parent, set up a pipe between the child and parent or arrange some other form of IPC to pass info back and forth.

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

Sidebar

Related Questions

Apologies if this is a very basic question, but I am preparing to create
This might be very basic question to some but I am struggling for quite
This is a very basic question, I only post because I've spent already some
This is a very basic question - how do I create Kendo UI controls/how
This is very basic question from programming point of view but as I am
This is very basic magento question i guess. I want to first get all
This is a very basic question, so please bear with me. Consider the following
This is a very basic question...quite embarassing, but here goes: I have a Stopwatch
This is a very very basic question and I know one way is to
This is a very basic question, but my brain isn't working and multiple attempts

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.