Re: GDB: Does "catch vfork" work?
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