1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
labwork [276]
3 years ago
11

Write a C program that spins a child process. The child process reads a number from the keyboard and passes the number on to the

parent process via a pipe. The parent process waits until number becomes available and reads it from the pipe, prints the number to the screen and exits.
Computers and Technology
1 answer:
Murrr4er [49]3 years ago
4 0

# include <stdio.h>

int main()

{    

   int pid;

   pid=getpid();

   printf(\"Current Process ID is : %d\\n\",pid);

   printf(\"[ Forking Child Process ... ] \\n\");    

   pid=fork(); /* This will Create Child Process and

              Returns Child\'s PID */

   if(pid < 0)

   {

       /* Process Creation Failed ... */

       exit(-1);

   }

   else if(pid==0)  

   {

       /* Child Process */

       printf(\"Child Process Started ...\\n\");

       printf(\"Child Process Completed ...\\n\");

   }

   else  

   {

       /* Parent Process */

       sleep(10);

       printf(\"Parent Process Running ... \\n\");

       printf(\"I am In Zombie State ...\\n\");

       while(1)

       {

           /*  

               Infinite Loop that Keeps the

                  Process Running

           */

       }

   }    

   return 0;

}

# include <stdio.h>

int main()

{    

   int pid;

   pid=getpid();

   printf(\"Current Process ID is : %d\\n\",pid);

   printf(\"[ Forking Child Process ... ] \\n\");    

   pid=fork(); /* This will Create Child Process and

              Returns Child\'s PID */

   if(pid < 0)

   {

       /* Process Creation Failed ... */

       exit(-1);

   }

   else if(pid==0)  

   {

       /* Child Process */

       printf(\"Child Process Started ...\\n\");

       printf(\"Child Process Completed ...\\n\");

   }

   else  

   {

       /* Parent Process */

       sleep(10);

       printf(\"Parent Process Running ... \\n\");

       printf(\"I am In Zombie State ...\\n\");

       while(1)

       {

           /*  

               Infinite Loop that Keeps the

                  Process Running

           */

       }

   }    

   return 0;

}

You might be interested in
Will give brainlyist
In-s [12.5K]

i think its the first sentence: Mobile devices have become the main source of communication for many people around the world

if im wrong im dum ;-;

6 0
3 years ago
Read 2 more answers
Methods for preventing/overcoming group conflict include all EXCEPT:
kondor19780726 [428]

Answer:

recognizing that gender differences are a myth.

Explanation:

The options are:

  • active listening.
  • recognizing that gender differences are a myth.
  • structured debate.
  • building cross-cultural understanding

Without active listening, structured debate, and cross-cultural understanding group conflict are definitely on the card. However, no one now is concerned about gender differences. As now both the genders are already having the equal status in at least developed countries. However, this too can play a role in avoiding group conflict. However, since this is not that important considering the current context, this looks like being the correct option here. Hence, the above mentioned in the answer section is the correct option.

7 0
3 years ago
PLEASE HELP!!! History abounds with instances in which the work of scientists and artists were affected by the political, religi
Masteriza [31]
Social Media affects them
7 0
3 years ago
Research: "How was your experience on site '4chan'?"<br><br> Please answer in the box below.
olganol [36]

Answer:

My experience was comfortable

Explanation:

This website is pretty simple and loads fast, there are a lot of images with high quality but only when you click over of the image this expands in the original size.

I could find really helpful information, there are different subjects, but this is not a website for kids for some adult content.

I didn't need to register any information to share content or if you want to ask something and everything is anonymous.

5 0
3 years ago
HINTS;
ExtremeBDS [4]
Good job! please mark as branliest?!
4 0
2 years ago
Other questions:
  • The following is true about SPAM ________.
    9·1 answer
  • What sends massive amounts of email to a specific person or system that can cause that user's server to stop functioning? mail b
    6·1 answer
  • David has created a lot of styles and now his Quick Style Gallery contains styles he no longer uses.
    14·2 answers
  • Cual es la herramienta de google que funciona como oficce ?
    11·1 answer
  • Multiple Intelligence Theory explains that...
    8·2 answers
  • I need help with this line of code:
    5·1 answer
  • Video is a medium that's looks real anyways, but is real________________.
    10·1 answer
  • Answer for 5,6,7 any one know plz
    8·1 answer
  • What keys on the keyboard have the ability to move the cursor around on a window?
    11·1 answer
  • What would a good digital citizen do if he sees his classmate left her email account open on a school computer by mistake?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!