[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vfork()
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
MAASK Group wrote:
> >Vfork is a combination of fork() and exec().
>
> I am confused. The programmer explicitly has to call exec() after a
> vfork(). right?
right, vfork() isn't a combination of fork() and exec(), more exactly, it's a
version of fork() to be used only when immediatly followed by a exec()
so, instead of writing
if (! fork ())
exec (...);
you could write
if (! vfork ())
exec (...);
and avoid the copying of the process segment that would be overwritten by
exec(). in modern OSs, the process is marked copy-on-write, so it's just as
fast, without the restrictions. that's why it's man page tells you not to
use it anymore.
- ------
Javier
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+Rn3HsIoGnxsRK/ERAmzmAJ0YLEju/TRGLnX8asM3vEN/MgMVXQCgpdUL
B4WhKo2sgxVbxDkGq/QPbLo=
=Bxlb
-----END PGP SIGNATURE-----
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
- References:
- Re: vfork()
- From: "MAASK Group" <maask12345@hotmail.com>