samedi 17 janvier 2015

How fork and exec works?


I don't have much experience..just trying to get involved into the processes how do they interpret to Hardware from user level.


So when a command is fired from a shell, fork() inherits a child process of it and exec() loads the child process to the memory and executes.


My qs is:



  1. If the child process contains all the attributes of the parent process(which is the original process), then what is the need of this child process? The original process also could have been loaded to the memory.

  2. Does this fork and exec concept apply to all the executable program in UNIX?Like for shell script also or only for commands? Does it also apply for shell builtin commands?

  3. when copy on write concept is used if I'll execute a command/script?


Sorry for asking many questions at-a-time, but all these questions come to my mind at-a-time when am thinking about any command execution.


Thanks a lot !! Please help Guys..



Aucun commentaire:

Enregistrer un commentaire