I have confusion in creating a process in Linux. Up to now I thought that we can create the process by calling the following system calls.
system()
exec()
family of system callfork()
system callbut:
system(): But as "system" system call executing the input executable on shell and shell is creating a child process for the execution of input .here shell is calling child process then we can say that fork is creating process for this.
exec family of system call: As this family of system call over write the current running process with new process.So it is also creating a new process but using same address space. As I think it is also calling call fork for creating the process.
I am confused with the fact all the above is possible way of creating a new process or only fork system.
exec
family of system call does not call fork
, neither it creates a new process.
It only overwrites the existing process with the new binary.
In linux
user programs, fork
is the only function to create new process. Though fork
internally calls clone
and other system calls.
In other hands, system
is only a wrapper to fork
and exec
. The actual task of creating a process is done by fork
in system
. So system
is not a way to create new process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With