Sam Steingold writes:
Why not have an exec-like call which creates a new process (instead
of
replacing the current one with the new one)?
We already have that. Call system() with a `&' at the end of the
command string.
However, there are generally other things that one needs to do after
the fork, but before the exec.
For example, if you want the two processes talking, you want to do
some dup2() calls to make stdin and stdout be on pipes.
Also, how is vfork different from vork? [linux man says that
vfork=fork]
I assumes you mean "different from fork". Anyway, I tried to
summarize from memory, but it turns out that the man page on Solaris
explains it better that I can:
vfork() can be used to create new processes without fully
copying the address space of the old process. It is useful
when the purpose of fork() would have been to create a new
system context for an execve(). vfork() differs from fork()
in that the child borrows the parent's memory and thread of
control until a call to execve() or an exit (either by a
call to _exit() (see exit(2)) or abnormally). The parent
process is suspended while the child is using its resources.
--
Colin