what is the difference between fork() & exec()

Answers were Sorted based on User's Feedback



what is the difference between fork() & exec()..

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

what is the difference between fork() & exec()..

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

what is the difference between fork() & exec()..

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

what is the difference between fork() & exec()..

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

what is the difference between fork() & exec()..

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

what is the difference between fork() & exec()..

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

what is the difference between fork() & exec()..

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

what is the difference between fork() & exec()..

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

what is the difference between fork() & exec()..

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

what is the difference between fork() & exec()..

Answer / chander

fork() creates a new process
exec() excecte the process

Is This Answer Correct ?    7 Yes 36 No

Post New Answer

More Linux Socket Programming Interview Questions

How to Form Internet (IPv4) Socket Addresses?

0 Answers  


How to use the PF_LOCAL and AF_LOCAL Macros?

0 Answers  


How to create Sockets?

1 Answers  


What is the use of inet_addr() Function?

0 Answers  


What is the Use of the inet_lnaof() Function?

1 Answers  






What are sockets in linux?

0 Answers  


How to open socket file in linux?

0 Answers  


How to Understand Network Byte Order?

0 Answers  


How to Initialize a Wild Internet Address?

0 Answers  


What is the use of socketpair()?

1 Answers  


Can you send and receive on the same socket at the same time?

0 Answers  


What is socket file in linux?

0 Answers  


Categories