Re: What is the practical significance of fork

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

 



Hi guys,

On Wed, Dec 15, 2010 at 10:50 AM, Enrico Granata <egranata@xxxxxxxx> wrote:
> I believe his question actually sounds like: why does Linux need two system
> calls to start running a new program? Wouldn't it be simpler to do this the
> way Win32 does it: a CreateProcess() system call that actually loads a NEW
> program in  NEW process?

So fork is actually the heavyweight variant. It copies the page tables
of the calling process.

If you know that the fork will be followed by an exec, then you're
better off to use the lightweight version of fork, called vfork, which
does not copy the page tables of the calling process.

Also keep in mind that it's perfectly legal to call fork without calling exec.

And, fork and vfork are really just front-ends for clone which is the
function that deals with all of the variants...

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux