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. which chip is thought to be the first microprocessor? how many transistors roughly did it use?
vaieri [72.5K]
A micro processor is an integrated circuit that have all the functions of a central processing unit of a computer.
The chip which is thought to be the first microprocessor is INTEL 4004. It was manufactured by Intel in 1971. Intel 4004 has 2,300 transistors. 
4 0
4 years ago
Gross Domestic Product (GDP) is the economic report card for any country. What is the report card measuring?
GalinKa [24]
The answer is production.



6 0
4 years ago
Given integer variables totalTickets, vipTickets, and sessionNum, which line of code correctly calls the following function? voi
alekssr [168]

Given integer variables <em>'totalTickets, vipTickets, and sessionNum'</em>, the line of code given in option C correctly calls the following function: "<em>void FinalTally(int* totalAttendees, int* vipAttendees, int numSessions);</em>"

The correct function call with the variables named <em>'totalTickets, vipTickets, and sessionNum</em>' is as follows:

<em>FinalTally(&totalTickets, &vipTickets, sessionNum); </em>

A function call refers to an expression that passes control and arguments (if there are any) to the specified function and has the syntax as <em>FunctionName (argumentList</em>) where <em>FunctionName is the name of the function to be called and argumentList indicates the list of arguments (separated by commas) to be passed to the calling function</em>.

"

<u><em>Correct question is as follows:</em></u>

Given integer variables totalTickets, vipTickets, and sessionNum, which line of code correctly calls the following function? void FinalTally(int* totalAttendees, int* vipAttendees, int numSessions);

a. FinalTally(totalTickets, vipTickets, &amp;session Num);

b. FinalTally(&amp;totalTickets, &amp;vipTickets, session Num);

c. FinalTally(&totalTickets, &vipTickets, sessionNum);

d. FinalTally(&amp;totalTickets, &amp;vipTickets, &amp;session Num);

"

You can leran more about Function Call at

brainly.com/question/28566783

#SPJ4

3 0
1 year ago
What form of note taking would be MOST beneficial for a visual learner who needs to see the connections between ideas?
Svetlanka [38]

Answer:

Think link

Explanation:

8 0
4 years ago
A client is currently struggling with late-stage integration and manual deployments. They want to find another method that will
Papessa [141]

Answer:

It can deliver the services faster with higher reliability and quality

4 0
3 years ago
Other questions:
  • When u look at a green object through red glass the object will appear
    11·2 answers
  • How to divert all calls &amp; sms from other phone to my phone? is it possible?
    14·1 answer
  • Write a program that prompts a user to enter numeric values. As each value is entered, the program should: - Append the value to
    7·1 answer
  • What type of control repairs the effects of damage from an attack? Physical control Technical control Corrective control Logical
    5·1 answer
  • Monica needs to work on a document where she has to highlight topics in bold and add emphasis to some words in a paragraph using
    9·1 answer
  • A website must have a unique address with all the following features
    14·1 answer
  • Describe how to create a new folder on the desktop​
    12·2 answers
  • How to do the for loop in python
    12·1 answer
  • 1. If we want define style for an unique element, then which css selector will
    14·1 answer
  • Using an open connection to a small company's network, an attacker submitted arbitrary queries on port 389 to the domain control
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!