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
A(n) _____ is a fake online persona created to promote a particular point of view, often in praise of a firm, product, or indivi
drek231 [11]

Answer:

<u>Sock puppet</u>

Explanation:

A sock puppet, a reference to a puppet created by placing a sock over one's hand, is a misleading or fake online identity created to promote a particular point of view, often in praise of a firm, organization, product, or individual; to manipulate public opinion or to argue, bully or review products. Regardless of the purpose it was created for, sock puppets are rarely welcome in online communities and forums.

4 0
3 years ago
True or False? Wireless connections that use a higher frequency are faster but have a shorter range.
Rudiy27

Answer:

it's a True statement

6 0
3 years ago
The variables xp and yp have both been declared as pointers to integers , and have been assigned values (i.e., they are each poi
Amanda [17]

Answer:

Following code are:

int *temp;   //declaration of variable

// perform swapping

temp = xp;    

xp = yp;

yp = temp;

Explanation:

we declare an integer data type pointer variable "*temp"  then perform swapping between them.

The variables "xp" and "yp" are already declared and these variables are performing swapping among three.

6 0
3 years ago
When double quotes are used to assign values to string variables, the PHP interpreter must check the entire string to see if it
NikAS [45]

Answer:

Interpolation string.

Explanation:

The proces of adding the variable in middle the string.The interpolation  Replace the value of the Variable when the string data is processed .In the Interpolation process  the variable is permitted with string containing double quotes.In the interpolation string  the interpreter check the entirely string that  the variable in middle the string.

Following is the example of interpolation string in Php

$n1 = "RAM";

echo "hello $name"; // output

Output:

hello RAM

6 0
2 years ago
The Internet has been around for quite a while, but it did not have much impact on our everyday lives until the appearance of th
pishuonlain [190]

Answer:

The answer is "WWW".

Explanation:

WWW stands for World Wide Web, It is a combination of all Internet resources and users, that uses the hypertext transfer protocol. It provides world information that is available on the internet that is the expression of human knowledge. It is also known as a domain name that introduces resources or individual instances of the entire collection.

6 0
3 years ago
Other questions:
  • 14. Which commercial RDBMS product was the first to hit the market and is the biggest?
    15·1 answer
  • Match the tool to its description.
    15·1 answer
  • What can be entered in a search box to find data? data size a name relevance purpose
    5·2 answers
  • What movie would be greatly improved if it was made into a musical?
    6·1 answer
  • Does Buzz or APEX shows all your due assignments on the left of the main home screen?
    11·1 answer
  • A photographer uses which of these tools to form an argument?
    14·2 answers
  • I still haven't figured out how to award someone branliest will someone help me? If you explain to me how to do it i will do awa
    14·1 answer
  • 1. Identify one modern technology and discuss its development and discuss what future changes might occur that could have an eve
    13·1 answer
  • Write a logical expression using only and, or and not that is equivalent to the Exclusive NOR (XNOR) gate on 2 inputs, called in
    15·1 answer
  • The direction of a ratchet is reversed by _______________________.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!