what is the difference between fork() & exec()
Answers were Sorted based on User's Feedback
Answer / nitin
fork() creates a child process with most of the attributes
of the parent process. Both parent and child processes are
executed simultaneously.
exec() replaces the current process with a the executable
pointed by the function. Control never returns to the
original program unless there is an exec() error.
Is This Answer Correct ? | 89 Yes | 6 No |
Answer / laxman masadi
fork: Create a new process
exec: replace a process's objectcode with contents of file
(executable)
Is This Answer Correct ? | 53 Yes | 10 No |
Answer / alka
fork() creates a new process where exec() not....
exec() shares memory of parent here fork() process operates
independently...
Is This Answer Correct ? | 41 Yes | 15 No |
Answer / amit
what is the difference between fork() & exec()?
fork() creates a new child process and subsequently a new
entry in process table is made for the new process.
exec(), if successful, replaces the existing text segnent
of the process with that of new process. and hence, the old
process does not exists in the system any more. i dont
think, any new entry is created in the process table after
successful exec().
Is This Answer Correct ? | 17 Yes | 3 No |
Answer / anand
fork() created a newly independent process that has it's own
space in memory and also has own permission depends upon
what you assign
Using exec() the created process is a sub thread of calling
process. They also share area in memory and so that also
share all permission and resources.
Is This Answer Correct ? | 7 Yes | 2 No |
Answer / mahitha
fork creates a new process where the childs and the parents
address space wil be different
wen we use exec system cal,the child wil be made to share
the pages of the parent..also the permissions wil be shared
between the 2.
Is This Answer Correct ? | 6 Yes | 3 No |
Answer / gopi
fork() is used to creat new process.but execl() is used to load another application....see before going to load new,exexl() try to remove all data about old process..like old-----pid,vad,resourse
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / antony.t
fork() will create a new process and its a system call API its return values are- if fork created new process(child process), its pid will be returned, if it failed to create returns -1.
exec() is also a system call API but this will load a application, if exec() succeeds it will not return anything but 'll return -1 if it gets failed to load application...
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / dheeraj gahtori
processes began through a process called "fork and exec".
that is when one command starts another, the child process
first forks , the kernel copying over pages of memory from
the present process to a new location for the child process.
The child then execs, executing the new command and
overwriting the data
Is This Answer Correct ? | 8 Yes | 17 No |
Answer / chander
fork() creates a new process
exec() excecte the process
Is This Answer Correct ? | 7 Yes | 36 No |
What is the use of socketpair()?
How to Close Sockets?
How to Obtaine the Socket Address?
How to Form Abstract Local Addresses?
Q. what is the difference between socket & port ?
What is the setservent(3) Function?
What is the Use of the inet_netof() Function?
How to use the socket(2) Function?
What is the use of SOCK_DGRAM Socket Type?
Are udp sockets bidirectional?
What is socket file in linux?
How to Form Traditional Local Addresses?