Re:A fork() in the road
by swiley on Wednesday April 10, 2019 @01:09AM
(#19622029)
I thought Linux had clone which glibc called for their implementation of fork.
[ Parent
| on HN ]
Yes, the underlying syscall for fork() is clone [1], and the underlying syscall for exec*() is execve [2].
Section 6: REPLACING FORK
> Alternative: clone().
> This syscall underlies all process and thread creation on Linux. Like Plan 9’s rfork() which preceded it, it takes separate flags controlling the child’s kernel state: address space, file descriptor table, namespaces, etc. This avoids one problem of fork: that its behaviour is implicit or undefined for many abstractions. However, for each resource there are two options: either share the resource between parent and child, or else copy it. As a result, clone suffers most of the same problems as fork (§4–5).