is data shared between processes when we use fork in c?

前端 未结 3 796
故里飘歌
故里飘歌 2020-12-21 18:39

In this C program, data is not being shared between process i.e. parent and child process. child has it\'s own data and parent has it\'s own data but pointer is showing the

3条回答
  •  执笔经年
    2020-12-21 19:26

    When you fork a new process the new child process is a copy of the parent process. That's why pointers etc. are equal. Due to the wonders of virtual memory two processes can have the same memory map, but still be using different memory.

提交回复
热议问题