in reply to Using kernel-space threads with Perl

You may also consider using forks. Modern OSses give the appearance all the data is copied, but they'll implement it using COW, so it reality, data is only copied when it's rewritten in a process.

Of course, as pointed out elsewhere in the thread, first creating threads (or processes) and only then reading in the data wins.

  • Comment on Re: Using kernel-space threads with Perl

Replies are listed 'Best First'.
Re^2: Using kernel-space threads with Perl
by BrowserUk (Patriarch) on Mar 22, 2011 at 01:47 UTC
    data is only copied when it's rewritten

    Or treated as a number or ...


    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.

      But I suspect the real killer is when just inc/decrementing a ref count causes an entire page of memory to no longer be shared. But, despite this, I have seen some evidence of caches of Perl data staying partially shared, despite my expectation that this is way too easy to thwart. The case of each child not even looking at most of the data does make the odds improve some.

      If I wanted to share lots of data between Perl child processes, I'd probably at least consider storing that data via Judy.

      - tye