Hi Mulyadi,<div><br></div><div>Great to see you again!</div><div><br></div><div>Sorry, can I fork on your explanation to explain further about fork?<div><br></div><div>Yes, &quot;fork&quot; is at the core of process management, scheduling and all that:</div>
<div><br></div><div><a href="http://www.ibm.com/developerworks/linux/library/l-linux-process-management/">http://www.ibm.com/developerworks/linux/library/l-linux-process-management/</a></div><div><br></div><div>a good picture of process splitting up (forking) is here:</div>
<div><br></div><div><a href="http://www.linux-tutorial.info/modules.php?name=MContent&amp;pageid=83">http://www.linux-tutorial.info/modules.php?name=MContent&amp;pageid=83</a></div><div><br></div><div>what happened to all the IPC after forking?</div>
<div><br></div><div><a href="http://hzqtc.github.com/2012/07/linux-ipc-with-pipes.html">http://hzqtc.github.com/2012/07/linux-ipc-with-pipes.html</a></div><div><br></div><div><a href="http://static.usenix.org/event/usenix2000/general/reumann/reumann_html/node9.html">http://static.usenix.org/event/usenix2000/general/reumann/reumann_html/node9.html</a></div>
<div><br></div><div>Generally, the last thing u should read is the kernel source code, though it also has the last word to be said for fork() :-).</div><div><br></div><div>On Fri, Jan 18, 2013 at 1:59 AM, Mulyadi Santosa <span dir="ltr">&lt;<a href="mailto:mulyadi.santosa@gmail.com" target="_blank">mulyadi.santosa@gmail.com</a>&gt;</span> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi :)<br>
<div><div class="h5"><br>
On Fri, Jan 18, 2013 at 12:02 AM, Niroj Pokhrel &lt;<a href="mailto:nirojpokhrel@gmail.com">nirojpokhrel@gmail.com</a>&gt; wrote:<br>
&gt; Hi all,<br>
&gt; I have been using fork and exec for sometime. But I have no idea about what<br>
&gt; are the things done by the kernel when we fork or exec and how things work.<br>
&gt; How the kernel load new program and what all things are done ....... Can<br>
&gt; anybody please explain me this ? Thank you in advance.<br>
<br>
</div></div>this is too broad to answer, but in general fork() does:<br>
- preparing new address space<br>
- preparing new task_struct<br>
- doing COW (copy on write), so newly born child initially simply use<br>
parent&#39;s pages<br>
<br>
in exec() case, instead of COW, you load the target binary. It does so<br>
by the work of loader in user space and ELF interpreter in the kernel<br>
space.<br>
<br>
--<br>
regards,<br>
<br>
Mulyadi Santosa<br>
Freelance Linux trainer and consultant<br>
<br>
blog: <a href="http://the-hydra.blogspot.com" target="_blank">the-hydra.blogspot.com</a><br>
training: <a href="http://mulyaditraining.blogspot.com" target="_blank">mulyaditraining.blogspot.com</a><br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh
</div></div>