How the fork() System Call Actually Works in Linux
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…
We haven't written up this one. Dev.to has the full story — the link below goes straight to it.