[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how is "exec" executed by a shell?
On Friday 07 January 2005 08:22, Mandeep Sandhu wrote:
> a simple "man" on the shell wud cause the shell to fork a new
> process...cal exec to load "man's" code into the addr. space to
> start execution and "wait" (not sure of this!) for this child (i.e
> man here) to finish....right? does the shell handle calling "exec"
> from the prompt differently?!?
$ man
The shell will do a fork() and the child will do an exec(man).
The parent will wait for the child to finish
$ exec man
The shell will do an exec(man) -- the shell is gone.
$ exec man &
The shell will run "exec man" in the background.
It will call fork() but not wait.
The child will exec(man).
This is not much different from just "man &"
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/