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
On the Loan worksheet in cell c9 enter PMT function to calculate the monthly payment for the Altamonte springs 2018 facilities l
Delicious77 [7]

Answer and Explanation:

First of all we should have to know about PMT

PMT

stands for payment .payment that you want to send and receive.It is used in financial calculators and equation. It is a payment that return the periodic payment for a loan.

From the given statement we have to calculate the PMT  for this purpose .

let us consider example where we take loan amount and have some interest and then calculate it.

loan of amount = $6000.00

Interest rate = 4.20%

period per year=15

period = 60

then monthly payment = $ 111.40

Using Excel then we get the monthly payment in cell C9

as calculations has been shown in the excel.

where you can get function who returns a positive value.

6 0
3 years ago
Your sister has just emailed you an attached file with the invitation list for her upcoming party.
Andreyy89

Answer:

The file Extension so the answer is C

5 0
2 years ago
Read 2 more answers
Identify what a computer needs to
sergejj [24]
Digital sound because you want be able to hear
6 0
3 years ago
What do you think would have happened if early explorers had not followed their maps, charts, and compasses? (Give 4 examples in
enyata [817]

Answer:

If the explorers wouldn’t have followed their maps they would have gotten lost. Another thing that might of happened is maybe they would find someplace cool but they have no idea where they are. Without a map most captains would have probably been going in circles for years. Imagine if you didn’t have a map, you probably would have thought you were going to fall of the side of the earth, because back then the explores thought the earth was flat.

Explanation:

:) ur welcome hope I helped

8 0
3 years ago
Which is an example of an binary number?
Liula [17]
The second one
01111
This is because a computer uses binary and only understands two digits which consit of 1 and 0
8 0
3 years ago
Read 2 more answers
Other questions:
  • Andy, a developer, is designing a new program. Which tool should Andy use to help him complete his task?
    6·1 answer
  • Which of the following types of copyright license is most appropriate if you write a novel and would like to post it online for
    11·1 answer
  • Design and implement an application that reads an integer value representing a year from the user. The purpose of the program is
    6·1 answer
  • Give an example of an expression that has three terms. The first term should have two factors, the second term should have three
    14·1 answer
  • While saving her word-processed academic documents, Ashley includes the subject, title, and the author's name in the properties.
    7·1 answer
  • What are the advantages of using the internet as theinfrastructure for electronic commerce and electronicbusiness?
    6·1 answer
  • What does a converter do? A. It converts one technological system into another. B. It converts one type of electrical signal int
    10·2 answers
  • Help me, I'll mark brainiest
    12·1 answer
  • Write an algorithm to calculate the sum of integer ​
    7·1 answer
  • Design a for loop that gets 6 integer numbers from a user, accumulates the total of them, then displays the accumulated total to
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!