On most modern versions of Unix, all new processes will initially share all (or nearly all) of their memory with their parent (each new process gets its own new list of page table entries that define how to map virtual memory address ranges into real memory and/or swap space pages). After that, when any of the related processes writes to a shared page of memory, a fault will occur which will cause that page of memory to be copied to a page that is local to the writing process.

So you have to let your fork()ed processes run for a while before you can get a feel for how much memory they will manage to continue to share.

Since IO::Socket::SSL eventually uses some C code, you should be sure to put that code into a shared library. That way that chunk of memory will always remain shared between all processes (even if they aren't related) since the shared library is loaded using mmap (or an equivalent).

Perl code compiles to an opcode tree. I'm curious if Perl manages to leave large chunks of this tree as read-only so that related processes can continue to share that memory.

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

In reply to (tye)Re: 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.