<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>mikeash.com pyblog/friday-qa-2012-01-20-fork-safety.html comments</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2012-01-20-fork-safety.html#comments</link><description>mikeash.com Recent Comments</description><lastBuildDate>Sun, 12 Apr 2026 03:02:42 GMT</lastBuildDate><generator>PyRSS2Gen-1.0.0</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>mikeash - 2012-01-22 19:14:23</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2012-01-20-fork-safety.html#comments</link><description>Copy on write is an optimization and an implementation detail. Conceptually, the two processes have separate copies of everything from the beginning. Thus a copy gets created if either side modifies memory.</description><guid isPermaLink="true">6a4df6981fc483df45059d7fcc485df1</guid><pubDate>Sun, 22 Jan 2012 19:14:23 GMT</pubDate></item><item><title>Heath Borders - 2012-01-22 17:35:28</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2012-01-20-fork-safety.html#comments</link><description>Does the child's copy-on-write view of the parent change when the parent changes memory? Does the memory only copy if the child modifies it, or if either the child or parent modify it?</description><guid isPermaLink="true">95bfa5d04a81e1c78c24d51cf0c0a2b7</guid><pubDate>Sun, 22 Jan 2012 17:35:28 GMT</pubDate></item><item><title>Gwynne Raskind - 2012-01-21 04:26:04</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2012-01-20-fork-safety.html#comments</link><description>&lt;b&gt;Russell F.:&lt;/b&gt; The article actually answers that question, with a little inference: Almost nothing is safe to do between &lt;code&gt;fork()&lt;/code&gt; and &lt;code&gt;exec()&lt;/code&gt;. CoreFoundation detects the case where you try to do something with it at such a time and blows up on that symbol because that's the easiest way to tell you what went wrong without trying even more things that potentially aren't safe.</description><guid isPermaLink="true">ac3831292bea2904a562e7dbdc37ba81</guid><pubDate>Sat, 21 Jan 2012 04:26:04 GMT</pubDate></item><item><title>Russell F. - 2012-01-21 03:20:16</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2012-01-20-fork-safety.html#comments</link><description>This is a great discussion of fork()/exec() from a general Unix viewpoint, but I was hoping to see additional commentary on Mac-specific issues, such as the reason why there is a function called __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() :-).</description><guid isPermaLink="true">ef52e53eb41356addd097a3669ede541</guid><pubDate>Sat, 21 Jan 2012 03:20:16 GMT</pubDate></item><item><title>Ben G. - 2012-01-20 17:08:48</title><link>http://www.mikeash.com/?page=pyblog/friday-qa-2012-01-20-fork-safety.html#comments</link><description>Another important thing to note is that, unlike file descriptors, Mach ports are *not* cloned after a fork.
&lt;br /&gt;
&lt;br /&gt;Even if you're careful to only use a single thread in your process, and set up all your Mach ports before fork()ing, all Mach ports in your process are invalidated when you fork. (More specifically, the kernel just doesn't duplicate the ports into the new process.)</description><guid isPermaLink="true">31fca7c2a98f8019a7b136adf6797a9b</guid><pubDate>Fri, 20 Jan 2012 17:08:48 GMT</pubDate></item></channel></rss>
