The fork() System Call
pid_t pid = fork();
if (pid == 0) {
printf("I am the child!\n");
} else {
printf("I am the parent of %d!\n", pid);
}
⚡ Copy-on-Write (COW)
Rather than copying gigabytes of RAM during fork(), the kernel marks all page table entries as read-only. A page is physically cloned only when one process attempts to write to it.
Explore the full interactive process lifecycle on Binary Dose.
Top comments (0)