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 person you respect who offers you advice and assistance is known as a(n) _____.
Archy [21]
This would be a mentor-D. They role is to mentor or guide you with advice or assistance. A role model is a similar answer in that they respect you, but they might not offer advice or assistance which makes it incorrect.
7 0
2 years ago
is this statement true or false ? satelite and remote sensing devices have helped cartographers make more accurate maps with spe
Genrish500 [490]

Answer:

Yes this statement is true

Explanation:

Satelites help show a visual to cartographers to make more accurate maps easier.

3 0
3 years ago
In distributed dos attacks, the attacker sends messages directly to ________. bots the intended victim of the dos attack backdoo
kirill115 [55]
The word DoS refers to the Disk Operating System. In the case given above, if it happens that there is a distributed DoS attack, the attacker then sends messages directly to the BOTS. Bots refer to internet or web robots. Hope this answer helps. The answer is the first option.
4 0
3 years ago
Let f and g be two one-argument functions. The composition f after g is defined to be the function x 7→ f (g (x)). Define a proc
Ghella [55]

Answer and Explanation:

(define (compose f g)

(lambda (x) (f (g x))))

6 0
3 years ago
What term is used to describe the process of monitoring operating results and comparing actual results with the expected results
s344n2d4d5 [400]

Answer:

controlling

Explanation:

hope this helps

7 0
2 years ago
Other questions:
  • Write a program that uses the function isPalindrome given in Example 6-6 (Palindrome). Test your program on the following string
    9·1 answer
  • To make sure that you do not get too tired when typing for long periods, how often should you get up and stretch? Every 15 minut
    9·1 answer
  • A word that has a specific, predefined meaning in a programming language is called
    8·1 answer
  • Which option correctly describes a DBMS application? A. software used to manage databases B. software used to organize files and
    7·2 answers
  • Write a function shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than
    7·1 answer
  • If data from a DOS system is electronically sent to an EHR or other Windows-based system via an interface to populate an indexed
    7·1 answer
  • Please help me ASAP! Here is the question.
    15·1 answer
  • Your network has been having problems lately when users are participating in video conferences - the video and audio stutters ve
    13·1 answer
  • A user calls the help desk reporting that a laptop with Linux freezes on startup and displays kernel panic. What could cause thi
    12·1 answer
  • Who is the best nfl team in your mind
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!