841 views
2 votes
2 votes
By using fork system call, we create an exact copy of the current process and copies all its code, data to a new process.
While data will be changed along with the execution of the program, code will remain same. So is it possible that operating system keep a single code data and map to parent as well as child process unlike to copy code also?

1 Answer

1 votes
1 votes
A process can not alter the data of another process ( its the function  of O. S)  

And it the program code is one (shared  btw childrens and parent) then every process is gaining  access  to alter each others data. And hence operating system is forced to provide a  exact new copy to each of his children

Related questions

2 votes
2 votes
3 answers
1
Philosophical_Virus asked Dec 10, 2023
765 views
Int main (){fork();printf("a");fork();printf("b");return 0;}How many distinct outputs are possible of above code? And also give outputs
0 votes
0 votes
1 answer
2
Erwin Smith asked Apr 11, 2023
755 views
void main() { int n = 1; if(fork()==0) { n = n<<1; printf(“%d, “, n); n = n <<1; } if(fork()==0) n=n+700; printf(“%d, “,n); }Which of the following output is not ...
0 votes
0 votes
2 answers
4
dd asked Sep 15, 2018
1,029 views
The fork system call creates new entries in the open file table for the newly created child process. [True / False][ what is open file table ? ]