What I was describing was "copy on write" (I probably should have at least mentioned that term, eh?). I must have done a poor job of describing it if you didn't recognize it. Sorry.

My question was whether code that is compiled before the fork() would remain shared (for very long) after the fork() or whether Perl updates things (like reference counts or state information) in the opcode tree itself such that Perl running the code causes the opcode tree to be written to and that memory to become unshared.

I recall this coming up a long time ago and vaguely recall that the opcode tree was written to and someone thinking about trying to change that. I wonder if that memory is at all accurate and if any changes were made.

BTW, your description of memory architecture matches my understanding of the common layout. Perhaps one missing piece is how mmap() fits in. mmap() was a great idea that unified how the page file (a.k.a. swap space) worked with shared memory and I/O buffers.

        - tye (but my friends call me "Tye")

In reply to (tye)Re2: collective unconcious (about shared memory...) by tye
in thread collective unconcious (about shared memory...) by dshahin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.