what is difference between fork and vfork?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kapilddit
    New Member
    • Aug 2012
    • 1

    what is difference between fork and vfork?

    when to use fork and vfork? I am using execl in my child. which one I need to use?
  • techboy
    New Member
    • Apr 2014
    • 28

    #2
    vfork() is an obsolete optimization. Before good memory management, fork() made a full copy of the parent's memory, so it was pretty expensive. since in many cases a fork() was followed by exec(), which discards the current memory map and creates a new one, it was a needless expense. Nowadays, fork() doesn't copy the memory; it's simply set as "copy on write", so fork()+exec() is just as efficient as vfork()+exec().

    Comment

    Working...