What do fork() internally call?
Answers were Sorted based on User's Feedback
Answer / sasidhar
fork internally calls sys_fork() where sys_fork() calls do_fork().
sys_fork() do the following functions
-> calls do_fork()
-> return PID
do_fork() does the following functions
-> creates a new process
-> Assign a new PCB
-> copies PCB of parent to new PCB with little bit changes in context.
-> return
so if any process calls fork() two number of returns occur and after returning from do_fork() to sys_fork(). sys_fork decides what value to be returned to parent process and child process
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / bhushan bachhav
Linux implements fork() via the clone() system call.
The clone() system call, in turn, calls do_fork().
The bulk of the work in forking is handled by do_fork(),
which is defined in kernel/fork.c.This function calls
copy_process() and then starts the process running.
If copy_process() returns successfully, the new child is
woken up and run. Deliberately, the kernel runs the child
process first.
| Is This Answer Correct ? | 4 Yes | 3 No |
what are the different ways the Linux can swich from User Space to Kernel Space & vice-versa ?
what kind of information the linux driver modules (.ko ) files has ?
what happens when we do insmod & rmmod in Linux Device Drivers ?
How to create secured appeche web sever ?
how to configure sendmail server on red hat linux version 4 and what and all we Require?
how to create a ftp user on redhat linux 4.0?
if root user forget the password how to change it?
how to configure http server on red hat linux4.0?
why the kernel panic error was appering?
what is the difference between user APIs and kernel system calls ?
what are Softirq's and how many major numbers be allocated in the linux kernel(2.4) ?
what is mean by raid and what are all raids available even in software and hardware?