Please see the following figure showing the memory layout of a process::When someone forks(), and a new task_struct is assigned, what happens to the addresses of the process? In more or less other words: Imagine there is one process, so the image below holds. Now suppose I do a fork. What happens?
How does forking affect a process's memory layout?
linux;process
After fork, you have two copies of the same program. The kernel can either copy all of the address space or copy-on-write. In the latter case, the text and data sections will probably always be shared by both processes, and the stack will be copied IF the child needs to modify it, so on and so on. 