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

前端 未结 3 822
故里飘歌
故里飘歌 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:18

    fork creates exact copy of the parent process memory image (exception see in man page). This is called Copy On Write(COW) fork. Upto time child only read data, both parent and child have same copy of data but when child write, a new copy is generated and then both child and parent have different copyies for their own data

提交回复
热议问题