I'm saying that in the following code:

That between the first thread starting its 1 second sleep, and the second thread starting its one second sleep, the main thread has to start that second thread. So the differential between thread 1 iterating the shared hash, and thread 2 iterating the shared hash, even on a system that can run all 3 threads immediately and concurrently, has to be at least the time taken to spawn a new thread.

And given I know some of what is involved in spawning a new thread, I find it totally improbable that it would take the first thread longer to iterate the two-key shared hash than it would take the main thread to request the OS to create a new thread, and then go through the process of cloning the spawning threads environment into that new thread.

And that is what it would take for those two threads to be iterating the shared hash concurrently. And that just doesn't add up.

The timing produced by the code above show that with the two threads dumping the hash with a time differential of at minimum, one thread spawn&clone operation apart, the possibility that first thread is still in the progress of iterating the hash when the second thread starts it very unlikely. There is a 3-orders of magnitude differential involved.

C:\test>junk2 0 : 1227891440.24088 } 0 : 1227891440.26269 } 22 milliseconds to start a thread 0 : 1227891440.26288 0 : 1227891440.28761 } 24 milliseconds to start a thread 1 : 1227891441.27213 } $VAR1 = { 'a' => {}, 'b' => {} }; 1 : 1227891441.27275 } 62 microseconds to dump the hash 2 : 1227891441.28775 } $VAR1 = { 'a' => {}, 'b' => {} }; 2 : 1227891441.28835 } 60 microseconds to dump the hash

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^21: does threads (still) memleak? by BrowserUk
in thread does threads (still) memleak? by faxm0dem

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.