• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: GDB: Does "catch vfork" work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GDB: Does "catch vfork" work?


  • Subject: Re: GDB: Does "catch vfork" work?
  • From: Jim Correia <email@hidden>
  • Date: Sun, 9 Oct 2005 09:51:07 -0400

On Oct 8, 2005, at 6:55 AM, Damien Bobillot wrote:

If you use fork, the whole parent memory is copied.

There is no reason the kernel could't (or doesn't) use copy on write semantics for fork, AFAIK. Whether or not it actually does it is another question.


If you use vfork, the memory is lazily copied : the system wait until it really need to make the copy, ie if both processes don't write anything in a given memory page, the system won't make the copy, but if one do write something, the system make the copy just before effectively writing things. This use the copy-on-write flag of the paged memory manager.

The only difference between fork and vfork is that vfork is more efficient : for the developer, even when debugging, both functions seem to work the same way.

Again, I'm not a complete expert on the topic, but my understanding is that vfork does not use copy on write semantics, but rather shares the parent's address space until the exec. If you do anything after the fork and before the exec you are making changes in the parent's address space (and they are probably unexpected changes from the parent's POV.) My experience is consistent with this. (In other words, I believe the man page to be correct.)


Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: GDB: Does "catch vfork" work?
      • From: "Justin C. Walker" <email@hidden>
References: 
 >GDB: Does "catch vfork" work? (From: Daniel Jalkut <email@hidden>)
 >Re: GDB: Does "catch vfork" work? (From: Damien Bobillot <email@hidden>)
 >Re: GDB: Does "catch vfork" work? (From: Daniel Jalkut <email@hidden>)
 >Re: GDB: Does "catch vfork" work? (From: Damien Bobillot <email@hidden>)

  • Prev by Date: Can I create a Cocoa palette based on Carbon?
  • Next by Date: Re: GDB: Does "catch vfork" work?
  • Previous by thread: Re: GDB: Does "catch vfork" work?
  • Next by thread: Re: GDB: Does "catch vfork" work?
  • Index(es):
    • Date
    • Thread