This is the mail archive of the
mailing list for the GCC project.
Re: Is there any reason to use vfork() ?
- From: David Brown <david dot brown at hesbynett dot no>
- To: "Michael N. Moran" <mnmoran at bellsouth dot net>, niXman <i dot nixman at autistici dot org>
- Cc: pinskia at gmail dot com, gcc at gcc dot gnu dot org
- Date: Tue, 13 May 2014 22:46:13 +0200
- Subject: Re: Is there any reason to use vfork() ?
- Authentication-results: sourceware.org; auth=none
- References: <db279b78b31710a4d4a38e37817520e9 at autistici dot org> <D5C7AF9D-88B7-4683-A45B-5D7506D4B97F at gmail dot com> <438b671e26e4e2e3d10e0e0b81a57108 at autistici dot org> <53723E86 dot 50905 at bellsouth dot net>
On 13/05/14 17:47, Michael N. Moran wrote:
On 05/13/2014 10:59 AM, niXman wrote:
pinskia 2014-05-13 18:47:
Can you share more information about this env.
This is specially built distributive used for micro-pc.
It might be a bug not in gcc.
I'm sure that the bug not in the GCC. After I wrote to this
ML I made sure that freezes any program using 'vfork()'.
I'll deal with it ...
I just wanted to understand the reasons to use 'vfork()'
instead of 'fork()'.
I cannot speak for GCC, but I work with embedded Linux
systems and we use vfork() to reduce the memory footprint
of child processes. When a process is created with
fork() it's memory footprint is the same as the parent
process (copied page tables). The same is not true with
This is particularly important in the embedded systems
space with limited RAM.
Consider the system RAM requirements for a parent process
with a large RAM footprint that needs to spawn a child
process with an otherwise much smaller RAM footprint.
It can also make a big difference if the MMU is limited, or slow to work
with (as can be the case in embedded Linux systems), since you don't
need copy-on-write for vfork(). This is particularly true for ucLinux
on embedded systems without an MMU, in which fork() does not exist and
you have to use vfork().
Of course, you are not likely to run gcc on such systems.
However, I believe that vfork() is much more efficient than fork() on
Windows, because Windows does not have a proper fork() equivalent. If I
am correct in this, then this would make a big difference to