The fork system call in Unix-like operating systems creates a new process by duplicating the parent process. The post explains how this system call works, returning two values to indicate whether you are in the parent or the child process. It dives into the assembly and kernel details to reveal how these processes manage identical code but separate paths. The post also explores the implementation of fork in xv6 and Linux kernels, showing step-by-step how the kernel sets up the return values and manages process duplication.

16m read timeFrom blog.codingconfessions.com
Post cover image
Table of contents
System Call Calling ConventionAn Illustrative Example of Using Fork and ExecThe Implementation of the fork System Callfork Implementation inside the XV6 KernelLinux’s Implementation of fork()ResourcesSummary

Sort: