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
_____ can be used to convert digitized documents into ASCII (American Standard Code for Information Interchange) text that can b
solniwko [45]

Answer:

Optical Character Recognition

Explanation:

Optical Character Recognition is a method that is used to read character and bar codes. They convert scanned image into digital format. In other words ASCII text can be formed when a digitized document is converted.OCR is a method that convert document into word.

Here are some OCR tools which convert digitized format into machine readable text.

  • Microsoft Document
  • Microsoft One Note

8 0
3 years ago
PLEASE HELP ME !!! THIS IS DUE TODAY AND IM STUCK ON IT!!! Pls❤️✨❤️
Georgia [21]
What do you need help with?
4 0
3 years ago
in python, using the simplest form the print_seconds function so that it prints the total amount of seconds given the hours, min
PolarNik [594]

Answer:

I'm guessing you want a function so...

def print_seconds(hours, minutes, seconds):

seconds += 3600 * hours + 60 * minutes

print(seconds)

return 0

Hope this helps. :)

4 0
3 years ago
Which is an aspect of structural-level design?
DENIUS [597]
I think it’s D. Sorry if it’s wrong
5 0
3 years ago
Read 2 more answers
What process does a system use to officially permit access to a file or a program CIS 502 ?
ipn [44]

Answer:

Authorization                                

Explanation:

Authorization is a security process to determine access levels related to system resources such as files, services, computer programs, data and application features. This is the method of allowing or denying access to a resource which enables the user to get access to various services and resources depending on the user's identity.

Authorization is the process that checks if a user has the permission to get access to a particular file or perform a particular action, ensuring that user has successfully authenticated himself. It refers to defining access policy.

For example a system administrator determines for the system device, in multi-user computer systems, which users are granted access to system and its resources and privileges are granted.

4 0
3 years ago
Other questions:
  • Which two editions of Windows 7 support 64 bit CPUs? Choose two out of Professional, Business, Starter, or Home Premium.
    12·1 answer
  • Any parameter that receives a value and also sends a value outside the function must be declared as a reference parameter.
    8·1 answer
  • ​Browser-based database applications differ from traditional applications in that they​ ________.
    15·1 answer
  • As a compositional mode for electronic? media, __________ help people find their way through an unfamiliar system or? subject; t
    7·1 answer
  • Moore’s law refers to?
    5·1 answer
  • Write the definition of a function half which recieves a variable containing an integer as a parameter, and returns another vari
    15·1 answer
  • analyze the ethical issues in the use of information technology in Multinational company (MNC) and support you answer with one e
    15·1 answer
  • How do medical detectives investigate their cases?
    15·2 answers
  • How do you merge on excel?​
    5·1 answer
  • Wha are the types of slide show? define​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!