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
How can i address inv file in c for open it?
Paul [167]
Launch a .inv file, or any other file on your PC, by double-clicking it. If your file associations are set up correctly, the application that's meant to open your .inv file will open it.
Or else
With a extension?
5 0
3 years ago
How does one build social capital?
iren2701 [21]

Answer:

by building on line presence

Explanation:

If you put yourself out there in multiple social sites you will build a following

3 0
2 years ago
Sherri is considering replacing a processor on her laptop. The laptop is running slower than she would like. What should Sherri
Schach [20]

Answer:

Option b, Option c, and Option d  are the correct options.

Explanation:

While Sherri is replacing the laptops processor because her's laptop working slow as compared to the past performance then, she decided to ensure to use the right processors for her laptop's motherboard. Then, she verifies that not under the warranty, and she also determines that the teardown procedure is available or not.

4 0
3 years ago
Why would Network Systems employees be employed by the government?
Ghella [55]
Well knowing how the government is with security id go with A. as it makes a lot of sense unlike B and D and if they were looking for software the question would mention it
8 0
3 years ago
Read 2 more answers
Match the careers with the career clusters.
creativ13 [48]
<h2>Answer and Explanation:</h2>

The picture shows the right careers with their respective career clusters.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Before responding to an e-mail from another student in an online course, a student should
    13·2 answers
  • A __engineer specializes in computer hardware design and integration.
    15·1 answer
  • Is printer an input device​
    5·1 answer
  • My home PC has IP address 192.168.1.22 and connects to the Internet through a NAT router. Assume I am downloading a web page fro
    5·1 answer
  • When you create a new slide in a presentation program, you are promoted to choose a placeholder. True or false?
    11·2 answers
  • At the moment i am tackling the cs50x projects and i need a little bit of help with problem set 1, the 'greedy algorithm'. I am
    5·1 answer
  • A.<br> Post-It note<br> b.<br> notebook<br> c.<br> tutor<br> d.<br> spell check
    14·1 answer
  • In order to plan George’s birthday, his father gave him a list of people who attended his birthday for the last five years. What
    8·1 answer
  • What common variation of the Server Message Block (SMB) sharing protocol is considered to be a dialect of SMB?
    11·1 answer
  • A global clothing company is looking to create a more immersive shopping experience for customers.What is a way the company can
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!