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
This career involves answering questions about computer parts and trouble shooting broken computers? Video game designer, comput
adelina 88 [10]

Computer retail sales associate is my best guess. :)

3 0
3 years ago
List analog devices, Digital devices and hybrid devices
andrey2020 [161]

Answer:

Types of Hybrid Computers:

1. Large Electronic Hybrid Computer

2. General-Purpose Hybrid Computers

3. Special-Purpose Hybrid Computers

Examples of Hybrid Computers

1. Gasoline Station

2. Electrocardiogram Machine

3. Ultrasound Machine

4. Monitoring Machine

5. Research and Production Industries

6. Forensic

7. Defence

Types of Analogue Computers

1. Slide Rules

2. Differential Analysers

3. Castle Clock

4. Electronic Analogue Computers

5. Mechanical Analogue Computers

Examples of Analogue Computers

1. Thermometer

2. Speedometer

3. Analogue Clock

4. Seismometer

5. Voltmeter

6. Flight Simulators

7. Tide Predictors

Types of Digital Computers

1. Micro Computer

2. Mini Computer

3. Mainframe Computer

4. Super Computer

Examples of Digital Computers

1. Calculator

2. Digital Clock

3. Automobiles

4. Weighing Machine

5. Consumer Electronic Equipments

6. Smart Phones

7. Laptop/Personal Computer

8. ATM

3 0
2 years ago
If a business industry does not meet OSHA standards
soldi70 [24.7K]

Explanation:

USE SOCRACTIC IT WOULD REALLY HELP

7 0
4 years ago
Read 2 more answers
A call center is a _______.<br><br> JIT<br><br> CMA<br><br> CIC<br><br> SFA
sp2606 [1]

Answer: CIC

Explanation:

A call center is a customer interaction center (CIC) and it is the interface between call center agent with the customers directly. CIC are connected by the external telephone system and it uses as call center.

And the caller are basically identify by the telephone number and customer information are display in the CIC.

CIC are the modular structure for communication which include various components of CIC and framework.

4 0
4 years ago
Which data type is 2.5?<br> single<br> int<br> float<br> string
Ivenika [448]

2.5 is an example of a float.

Floats are numbers that have decimals.

5 0
3 years ago
Other questions:
  • Your dive computer indicates you need to make a mandatory decompression stop. You buddy's dive computer does not. You should: A.
    9·1 answer
  • Which of the following agricultural clusters would require administrative and financial training? biotechnology agribusiness sys
    8·1 answer
  • List three things that sally sue can improve
    12·2 answers
  • PLEASE HURRY!!!!!!!!!! WILL MARK BRAINLIEST!!
    13·1 answer
  • Explain in details three security countermeasures you know.​
    10·1 answer
  • Refer to the image of the Cornell method, then use the drop-down menus to complete each statement. Number 1 should be . Number 2
    8·2 answers
  • ¿Cuál es la diferencia entre una plataforma educativa y una tutoría?
    7·1 answer
  • Research the significance of the UNIX core of macOS and write a few sentences describing your findings.
    8·1 answer
  • Give the value of the zero flag, the carry flag, the signflag, and the overflow flag after each of the following instructions if
    8·1 answer
  • Toni is reviewing the status of his organization's defenses against a breach of their file server. He believes that a compromise
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!