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
The _________ contains frequently used formatting commands that are displayed when selecting text or objects with the mouse.
kolbaska11 [484]
The Answer is toolbar.
<span>The mini or small toolbar contains frequently used formatting commands that are displayed when selecting text or objects with the mouse.
Toolbar is also known as Ribbon. It is present in computer interface design. We can see toolbar in many softwares like Microsoft office suite, web explorer, designing softwares etc. it is mostly present under the menu bar and it has many options.</span>
3 0
3 years ago
What is a risk or an effect of software piracy?
Butoxors [25]
Piracy is a term used to describe the practice of obtaining or using software in a manner that is illegal or not in keeping with the terms under which the software was distributed. This can range from purchasing or copying the software, to using the software without a license, to selling, renting, or otherwise distributing it without authorization.<span>The Business Software Alliance estimated the losses to software companies in 2005 as a result of piracy at over $30 billion.</span>
5 0
3 years ago
Read 2 more answers
Using recursion, write a program that asks a user to enter the starting coordinates (row, then column), the ending coordinates (
Luden [163]

Answer:

The program in Python is as follows

def Paths(row,col):

if row ==0 or col==0:

 return 1

return (Paths(row-1, col) + Paths(row, col-1))

row = int(input("Row: "))

col = int(input("Column: "))

print("Paths: ", Paths(row,col))

Explanation:

This defines the function

def Paths(row,col):

If row or column is 0, the function returns 1

<em> if row ==0 or col==0: </em>

<em>  return 1 </em>

This calls the function recursively, as long as row and col are greater than 1

<em> return (Paths(row-1, col) + Paths(row, col-1))</em>

The main begins here

This prompts the user for rows

row = int(input("Row: "))

This prompts the user for columns

col = int(input("Column: "))

This calls the Paths function and prints the number of paths

print("Paths: ", Paths(row,col))

4 0
2 years ago
Type the correct answer in the box. Spell all words correctly. Joseph is a digital media developer and has years of work experie
Damm [24]

It is better to develop soft skills. Irrespective of profession, soft skill is a common skill which is required to be present in everyone to move along with others and continue the work successfully. A person who is good at technical need soft skill to work in collaboration with others, manage team, solve problems, etc.

So there are separate soft skill training provided for various roles and years of experience. So, I suggest to have soft skill training and do additionally MBA degree.

5 0
3 years ago
Basic python coding, What is the output of this program? Assume the user enters 2, 5, and 10.
r-ruslan [8.4K]

Answer:

17.0

Explanation:

after first loop numA = 0.0 + 2 = 2.0

after second loop numA = 2.0 + 5 = 7.0

after third loop numA = 7 + 10 = 17.0

8 0
3 years ago
Other questions:
  • A money ____ refers to moving a cash amount from one account to another.
    7·2 answers
  • What are the two main functions of user accounts in Active Directory? (Choose all that apply.) Allow users to access resources m
    7·2 answers
  • The second step when using the problem-solving process is to
    7·1 answer
  • ABC software company is to develop software for effective counseling for allotment of engineering seats for students with high s
    13·1 answer
  • Richard needs to copy information from another slide presentation that uses a different design template. To ensure that the info
    7·1 answer
  • What will the following code print out: int numbers [] = {99, 87, . 66, 55, 101}; for (int i = 1; i &lt; 4; i++) cout &lt;&lt; n
    11·1 answer
  • Write a C++ Programm in which inheritance is used
    7·1 answer
  • Xbox one is not turning on and power brick is orange why is that?​
    6·1 answer
  • The standard naming convention prefix tag for a query used to identify the object type is?
    10·1 answer
  • Criminal investigations are limited to finding data defined in the search ____.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!