Faster forking of large processes on Linux?

On Linux, you can use posix_spawn(2) with the POSIX_SPAWN_USEVFORK flag to avoid the overhead of copying page tables when forking from a large process. See Minimizing Memory Usage for Creating Application Subprocesses for a good summary of posix_spawn(2), its advantages and some examples. To take advantage of vfork(2), make sure you #define _GNU_SOURCE before #include … Read more

Why fork() twice [duplicate]

All right, so now first of all: what is a zombie process? It’s a process that is dead, but its parent was busy doing some other work, hence it could not collect the child’s exit status. In some cases, the child runs for a very long time, the parent cannot wait for that long, and … Read more