• 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: Return causes EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Return causes EXC_BAD_ACCESS


  • Subject: Re: Return causes EXC_BAD_ACCESS
  • From: vincent habchi <email@hidden>
  • Date: Sun, 31 Jul 2011 09:59:41 +0200

Le 31 juil. 2011 à 09:27, Ron Hunsinger a écrit :

> When a process forks, the child and parent get different virtual memory maps that, for the time being, happen to point to the same physical memory pages. The sharing is an implementation detail, for optimization. Conceptually, the parent's memory is copied into the child's memory space, so that if one of the processes modifies the "shared" memory, the other process does not see the change. The implementation, under the hood, does copy-on-write so that the cost of that copying can be deferred until needed. Since fork is usually followed by exec in the child, the copying usually never takes place, so it's a particularly good optimization. Don't be misled into thinking that just because the copying is deferred that the parent and child are actually sharing a single virtual memory space.

Thanks for these precisions. Actually, you’re right with fork (2), but vfork (2), AFAIK, does not copy anything; note that I’m aware that vfork usually is meant to be immediately followed by exec (3).

> The other methods you mention of sharing memory are by special arrangement, and rarely used (although extremely useful when they are).

I agree also. My point was to mitigate the statement that processes cannot share common memory. Of course, as you mentioned, in normal operation they don’t: That’s, after all, the whole point of the MMU, applications live in a memory sandbox. As far as I remember, wasn’t it D. Ritchie who related that, when developing on old PDP11/70, it was customary to yell "a.out !" when you were about to launch a program, because it gave others time to save their work before a possible general crash or data corruption?

Vincent


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Return causes EXC_BAD_ACCESS
      • From: Scott Ribe <email@hidden>
References: 
 >Return causes EXC_BAD_ACCESS (From: "Mr. Gecko" <email@hidden>)
 >Re: Return causes EXC_BAD_ACCESS (From: Graham Cox <email@hidden>)
 >Re: Return causes EXC_BAD_ACCESS (From: vincent habchi <email@hidden>)
 >Re: Return causes EXC_BAD_ACCESS (From: Ron Hunsinger <email@hidden>)

  • Prev by Date: Fwd: Ticker tape display
  • Next by Date: How can I eliminate the delay between pressing a global shortcut and the reaction of the triggered background process?
  • Previous by thread: Re: Return causes EXC_BAD_ACCESS
  • Next by thread: Re: Return causes EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread