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
Annette [7]
3 years ago
10

Assuming that the actual process ids of the parent and child process are 2600 and 2650 respectively, what will be printed out at

lines A, B, C, D, E, and F? Be sure to explain your answers. int main() { pid_t x, y; int value = 90; value += 30; /* fork a child process */ x = fork(); if (x < 0) { /* error occurred */ fprintf(stderr,"Fork failed"); return(1); } else if (x == 0) { /* child process */ y = getpid(); printf("child: x = %d",x); /* A */ printf("child: y = %d",y); /* B */ value += 20; printf("child: value = %d\n", value); /* C */ exit(0); } else { /* parent process */ y= getpid(); printf("parent: x = %d",x); /* D */ printf("parent: y = %d",y); /* E */ wait(NULL); printf("parent: value = %d\n", value); /* F */ } }
Computers and Technology
1 answer:
VashaNatasha [74]3 years ago
4 0

Answer:

Output explanation to the given code can be defined as follows:

Explanation:

In A the output is 0 , It will return fork value of the child process that is 0. so, 0 is printed during child process.  

In B the output is 2650 , in which the getpid() method returns the child process id  value that is 2650.  

In C the output is 140, As it is declared in key, all process have their own "value" copies. 20 are inserted during childhood, so 140 are written.  

In D the output is 2650, its fork() method returns the child ID to the parent process. so the value 2650 is printed.  

In E the output is 2600, Its getpid() method will returns parent process id  that is equal to 2600.  

In F the output is 120 Since the value is declared in primary, all process so their own "value" copies. 120 will be printed during process.

You might be interested in
$8.25/hour; _____$/year, when working 40 hours a week.
Katarina [22]
If you work 50 weeks/year and 40 hours/week, you will make 16,500 dollars per year if you make 8.25 per hour
8 0
3 years ago
Function prototypes and function definitions look similar because they have the same function heading. In a function prototype t
hjlf

Answer:

In a function prototype the heading is followed by a semicolon, whereas in a function definition the heading is followed by a function block.

Explanation:

As the function prototype only declares the function and the function definition defines the operations in the function.

e.g:

add(int x, int y);  is the prototype

add(int x, int y)

{

     int sum;

     sum = x+y;

}    is the function definition.

3 0
2 years ago
A ____ is a circuit board that contains most of a server.
8_murik_8 [283]
Motherboard






-------------------------------
6 0
2 years ago
Debevec mentions using the technology he described to animate entire human bodies. Discuss why you think this is or is not a goo
snow_tiger [21]

Answer:

Debevec is using the light of his team because this and that and because it’s manipulated

Explanation:

8 0
2 years ago
as the reader, you can figure out the writer's ____ based on his or her word choice and sentence structure a. purpose b. audienc
Misha Larkins [42]

Answer:

my choice purpose

Explanation:

the writer simply writes with a purpose to make his audience understand it's with the purpose that he writes

8 0
3 years ago
Other questions:
  • Your desktop computer monitor is not displaying a picture. What would you do to troubleshoot the problem?
    7·2 answers
  • When elements are placed on the page so that text and graphic elements are evenly distributed you have:
    9·1 answer
  • Professionals within the creative imaging fields must have which of the following items to showcase technical expertise?
    14·2 answers
  • A) Write 600 as the product of prime factors.<br> Give your answer in index form.
    7·2 answers
  • What is the reasoning you would write an inquiry to a company?
    5·2 answers
  • To add a new kind of information into the database you need to add a new table<br> true or false?
    7·2 answers
  • Which of the following statements is NOT
    15·1 answer
  • What is food technology​
    5·1 answer
  • TIMED QUIZ
    12·1 answer
  • What is one of four key principles of Responsible Artificial Intelligence
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!