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
What is the function of ctrl+Q​
vlabodo [156]

Answer:

Ctrl+Q is used to remove a paragraph's formatting

Explanation:

Hope that's the answer you're looking for!

5 0
3 years ago
What happens to a mechanical system when two opposing torques do not cancel out?
const2013 [10]
The system will move in the direction of the stronger torque
5 0
3 years ago
Gary says, "Ports are where data enter a network before reaching a gateway. The data travel via transmission
m_a_m_a [10]

The correct explanation of why Gary is wrong is that Ports are where connectors attach to destinations, not where data enter the network.

<h3>What is a port?</h3>

A port is physical part of the computer system where the external devices are connected using cables.

Therefore, it serves as an interface between the motherboard and an external device of the computer.

From Gary statement about ports, he is wrong because, Ports are where connectors attach to destinations, not where data enter the network.

Learn more about ports here:

brainly.com/question/4804932

#SPJ1

3 0
2 years ago
Define a function group-by-nondecreasing, which takes in a stream of numbers and outputs a stream of lists, which overall has th
Debora [2.8K]

Answer:

def group_by_nondecreasing( *args ) :

     num_list = [arg for arg in args]

     sorted_numlist = sorted( num_list )

     list_stream = [ sorted_numlist, sorted_numlist, sorted_numlist ]

     return list_stream

Explanation:

This python function has the ability to accept multiple and varying amount of arguments. the list comprehension shorten the logical for statement to generate a list of numbers, sorts the list in ascending order by default and duplicates the list in another list.

5 0
3 years ago
Plz help, correct answer will get brainliest (if i can, if i can't ill still rate and give thanks)
Elena-2011 [213]

Answer:

E-book : online edition of a new novel .

e-zine:online issue of today’s newspaper.

Online reference: online encyclopedia

blog: online website that posts restaurants reviews

Explanation:

Are you doing edge?

Also pleaseeeeeeeeeeeeeeeeeee mark me brainliest.

6 0
3 years ago
Other questions:
  • In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sid
    10·1 answer
  • Create a class called Clock to represent a Clock. It should have three private instance variables: An int for the hours, an int
    15·1 answer
  • This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by
    8·1 answer
  • What is one of the benefits of using templates for your email marketing campaigns?
    10·1 answer
  • The length property of the String object returns
    15·1 answer
  • What do astronomers call a system that is composed of more than two stars?
    9·2 answers
  • What is Automation ? Please give an example ?
    14·1 answer
  • Case Study/Scenario: First, Julio clicks Tools from the Chrome menu on the toolbar. Next, he looks for Manage Add-Ons but can no
    9·1 answer
  • Write 3 things that can't be done without technology.
    14·2 answers
  • Help me please. I'LL MARK BRAINIEST
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!