Hi!

On 23:31 Wed 15 Dec     , Chaitannya Mahatme wrote:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> 
> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
> </head>
> <body text="#000000" bgcolor="#ffffff">
> Hello Everyone,<br>
> <br>
> I tried finding answer to this question in many books but never quite
> got a satisfactory answer to this question. <br>
> <br>
> A fork process would replicate it parent, my question is <br>
> <ol>
>   <li>Why is fork necessary to create a process. Why replicate a
> existing process before creating a new process. <br>
>   </li>
>   <li>The exec algorithm is executed after fork which overrides what
> fork has done, then why do fork. Why can't we directly do exec.</li>

You may want to setup a specific environment for the new process, e.g.
redirect stdin/out/err or chdir() or chroot() or something else. This can be
done between fork() and exec() and would all have to be merged into into
exec(), if there would not be a fork before.

        -Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to