edited by
2,246 views
3 votes
3 votes

 

edited by

1 Answer

Best answer
7 votes
7 votes

Statement I - fork() creates a new process, and all local and global variables are copied to the new address space. Hence, the child process and parent process DO NOT share any variables, including global. So, this statement is false.*

Statement II - fork() creates a child process, with completely new address space, and hence they DO NOT share address spaces. The virtual addresses may look the same, however their physical addresses in the memory are different. So, this statement is false.

Statement III - Child process can terminate, on it's own. So, this statement is false.

Statement IV - Since, the parent can terminate on it's own without notifying child processes, thereby orphaning the child process, which are also known as zombie processes, this statement is false.

Statement V - fork() returns pid of child in the parent process, however in child process the pid is 0. (and -1 if it failed to create a child process) So, this statement is half correct, which makes it false.

 

[*] - Unix implements copy-on-write in the implementation of fork(), which is done for optimization. Copy-on-write means, the variables will be shared until they are modified. When they are being modified, the values will be copied to every address space.

 

selected by

Related questions

1 votes
1 votes
2 answers
1
♥_Less asked Jan 12, 2018
1,788 views
What is the number of child process created ?Answer given was 63, BUT i am getting 9 !
0 votes
0 votes
2 answers
2
Overflow04 asked Aug 29, 2022
858 views
On Solving manually I too getting 14 as answer. but on running more than 14 * are printed.
3 votes
3 votes
3 answers
4