Explain the fork() and exec() model of process creation. What happens to the address space during a fork()?
Last updated
fork()clones the calling process and returns twice: the child's PID in the parent and0in the child.The child gets a logically independent copy of the address space, implemented with copy-on-write: pages are shared read-only and copied only when written.
exec()replaces the process image with a new program (same PID, file descriptors usually kept). The gap between the calls lets the child set up redirection or pipes.
- https://dev.to/isbatbinhossain/fork-and-exec-the-weird-and-elegant-idea-behind-unix-process-creation-15mp
- https://projectlighthouse.io/books/os-fundamentals/pages/fork-exec-and-process-creation
- https://man7.org/linux/man-pages/man2/fork.2.html
- https://dev.to/farhadrahimiklie/understanding-fork-in-linux-how-process-creation-really-works-13id
- https://medium.com/@itsrajd/understanding-processes-and-system-calls-in-linux-fork-and-exec-explained-bd733911c359