-1

Possible Duplicate:
exec and fork()

I want to know what exec command is doing.

Fork creates new memory for child process right(With parent data) and when execs is called wha it is doing? Whether overwriting datas in the newly created memory or Parent process memory.

Community
  • 1
  • 1
Sijith
  • 3,740
  • 17
  • 61
  • 101
  • See http://stackoverflow.com/questions/1653340/exec-and-fork/1653415#1653415 and, please, try to search before asking questions :-) – paxdiablo Oct 01 '11 at 12:33

1 Answers1

0

As soon as you call fork, the child process cannot access the memory of the parent process anymore. A regular fork copies the complete memory stack of the parent process to the child process. When call execve (or a derived function call), the calling process will be replaced by the newly executed program. If you're just doing a fork to do an execve, you'd better use vfork, as it's a lot friendlier for memory allocation of the newly created child.

Friek
  • 1,533
  • 11
  • 13