Re: Porting vfork()

Linus Torvalds (torvalds@transmeta.com)
Fri, 8 Jan 1999 13:13:59 -0800 (PST)


On Fri, 8 Jan 1999, Kenneth Albanowski wrote:
> >
> > Yep, separate wait queue for each instance, child notifies parent, everything
> > is happy.
>
> Make sure that the parent hasn't gone away in the meanwhile.

It cannot - even if the parent goes away, p_pptr will just point to
another valid parent (ie init) instead. So it should always be safe to do
a "wakeup(&current->p_opptr->sleep)"

> Actually I'd be surprised if this vfork() would gain you anything on a
> normal system: I don't see how it's particularly better then clone(). As I
> said, I'm concerned with systems where fork() isn't feasible.

vfork() is a lot easier to use than clone() (you don't need to know about
threading, because everything is basically single-threaded as far as the
application is concerned - the only entity that needs to know about
vfork() is basically the compiler, because vfork() has setjmp() like
properties when it comes to automatic variables).

Also, there are actually old programs there that use vfork() already, so
you get some of it completely for free, without having to rewrite them to
use a Linux-specific clone()..

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/