Answer:
This is the complete correct program:
#include <stdio.h>
#include<sys/types.h>
#include<unistd.h>
int value = 128;
int main()
{
pid_t pid;
pid=fork();
if (pid==0) /* child process */
{
value +=8;
return 0; }
else if (pid > 0) {/* parent process */
wait (NULL);
printf ("PARENT: value =%d\n" ,value); /* LINEA */
return 0;
}
}
The output of the LINE A is:
PARENT: value = 128
Explanation:
The fork() function used in the program creates a new process and this process is the child process. The child process is same as the original process having its own address space or memory.
In the child process the value of pid is 0. So the if condition checks if pid==0. Then the child process adds 8 to the value of its variable according to the following statement
value +=8;
Now the original process has value = 128. In else if part the parents process has the value of pid greater than zero and this portion of the program is of the parent process :
else if (pid > 0)
{ wait (NULL);
printf ("PARENT: value =%d\n" ,value);
return 0; }
So the value 128 is printed at the end in the output.
wait(NULL) is used to wait for the child process to terminate so the parent process waits untill child process completes.
So the conclusion is that even if the value of the variable pid is changed in the child process but it will not affect the value in the variable of the parent process.
An advantage of renting a home is that you don't have to fix any appliances or structures of the home your landlord does that for you. disadvantages are you have to follow their rules, you can't change anything on the inside like the paint or add a room to the home. in the state of Washington and landlord can evict you with only 20 days notice if they want to permanently sell the property. that's called a no-fault eviction. that's all I can think of hope that helps
True.
You can create a permalink which is also a link inside your main content to link your topic to another similar or helpful topic. Sometimes we can put it in a way that we only pasted the entire link or just used a work then insert the link inside that work to redirect to another page
1. Motherboard (you plug all other components to it)
2. Processor (CPU)
3. Memory (RAM)
4. Graphics card
5. Sound card (sometimes integrated with motherboard)
6. Hard Disk Drive (HDD)
7. Power supply unit
Answer:
Your answer would be more likely.
Explanation:
When someone is upset and they are driving they usually have their music baring and the they can't hear their surroundings and all they can think about is what they are upset about so therefor they don't pay attention. Hope this helped! Have a great day! :)