What is difference between fork() and vfork()?what is the difference between function call and system call?

Questions by smanchineni

Showing Answers 1 - 2 of 2 Answers

siva2sk

  • Feb 24th, 2007
 

you should refer to a man page. both create a child process.
fork - parent and child are in 'running' status. they share all page tables until one of them does a write, then on-demand paging will create private page copy of the dirty page for the modifying process.
vfork - parent is suspended until child exits or exec's. mainly memory and stack are shared to the child.

underneath, they both are implemented using the same system call clone, except the flags to clone differ. which in-turn cause the process status and semantics to change as noted above.

  Was this answer useful?  Yes

siva2sk

  • Feb 24th, 2007
 

oh, i forgot to answer the part about function./system. calls

- function call is generally within the same protection space (ie. user mode to user mode or kernel mode to kernel mode).
- system call is when your process moves across boundaries (ie. user mode to kernel mode)

you can think of the functions you generally write/use from libc/libc++ as function calls. you can think of clone, read etc as system calls. your library call will setup appropriate values and call a special CPU instr to jump to the kernel mode, where a table lookup for the requested system call is performed and code jumps there.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions