Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I've already partly answered your question in Re: (ar0n: pnotes) Re: Sharing data structures among http processes?, to clarify another response.

To directly answer your question, I should explain that you are encountering a feature of Unix called copy on write memory.

Apache 1.x on Unix uses a pre-forking model, whereby a parent httpd process forks off a number of child httpds each of which handle one request at a time. When a Unix process forks, another identical process is created. To save memory, this identical process shares all of its data with the parent process. However, as soon as either process changes a certain area of memory, separate copies of that memory are created for each process. Hence the name copy on write. This is what you are observing as data become unshared.

Aside from memory requirements, the technique you are using suffers from another problem. Imagine you have 3 httpd processes (called A, B and C) serving requests, each with a name and phone number data structure. Initially, each process holds the following information:

NAME          PHONE
----          -----
Fingermouse   528
Bergen        392
Lobster       771
If process A receives a request to change Bergen's number to 398, the data structures in processes B and C will not be affected. So, if a request to retrieve Bergen's number reaches process C, it will report that Bergen's number is still 392. Thus, it is important to share data sets between processes if the data may be written to.


In reply to Re: Sharing data structures among http processes? by tomhukins
in thread Sharing data structures among http processes? by sutch

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (5)
    As of 2014-12-27 11:54 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (177 votes), past polls