Re: working of fork and exec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mulyadi,

Great to see you again!

Sorry, can I fork on your explanation to explain further about fork?

Yes, "fork" is at the core of process management, scheduling and all that:

http://www.ibm.com/developerworks/linux/library/l-linux-process-management/

a good picture of process splitting up (forking) is here:

http://www.linux-tutorial.info/modules.php?name=MContent&pageid=83

what happened to all the IPC after forking?

http://hzqtc.github.com/2012/07/linux-ipc-with-pipes.html

http://static.usenix.org/event/usenix2000/general/reumann/reumann_html/node9.html

Generally, the last thing u should read is the kernel source code, though it also has the last word to be said for fork() :-).

On Fri, Jan 18, 2013 at 1:59 AM, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote:
Hi :)

On Fri, Jan 18, 2013 at 12:02 AM, Niroj Pokhrel <nirojpokhrel@xxxxxxxxx> wrote:
> Hi all,
> I have been using fork and exec for sometime. But I have no idea about what
> are the things done by the kernel when we fork or exec and how things work.
> How the kernel load new program and what all things are done ....... Can
> anybody please explain me this ? Thank you in advance.

this is too broad to answer, but in general fork() does:
- preparing new address space
- preparing new task_struct
- doing COW (copy on write), so newly born child initially simply use
parent's pages

in exec() case, instead of COW, you load the target binary. It does so
by the work of loader in user space and ELF interpreter in the kernel
space.

--
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



--
Regards,
Peter Teoh
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux