Re: Sort-of Announce: Gnet, a network library



On  6 Jan, Sean Middleditch wrote:
| Well, on Linux, everything is loaded on demand, so it only copies the
| bits of process it needs.  I think that's how BSD and SysV UNICES work
| as well with vfork (), right?
| 
| Not that I know anything about BSD or SysV... ;-)

fork() is copy-on-write on all modern Unixes.

vfork() is usually either not present or implemented with the BSD
semantics (suspend parent).  Linux is somewhat unusual in providing a
vfork() call which is just an alias for fork().  (And again, recent
kernels changed that; there is now a CLONE_VFORK flag to clone() which
implements BSD vfork() semantics, and vfork() uses it.)

That said, I still consider vfork() a hackaround for buggy hardware
(broken VAX MMUs that didn't do COW right) and consider it best to avoid
the function entirely.  It's not good when any attempt at error recovery
after the child's exec() fails will damage the parent process....

-- 
brandon s. allbery      [os/2][linux][solaris][japh]     allbery@kf8nh.apk.net
system administrator         [WAY too many hats]           allbery@ece.cmu.edu
electrical and computer engineering                                      KF8NH
carnegie mellon university        ["better check the oblivious first" -ke6sls]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]