in reply to Re^2: Slow evolution of Perl = Perl is a closed Word (NQP, parrot concurrency == Oh dear.)
in thread Slow evolution of Perl = Perl is a closed Word

I really sincerely hope this doesn't come off as sarcastic, but...

How do you interpret those?
Well... depends on surrounding context. :-) I've not read the source code, but I'll play anyway.

Create a local copy of the PMC if necessary. (No copy is made if it is marked shared.) This includes workarounds for Parrot_clone() not doing the Right Thing with subroutines (specifically, code segments aren't preserved and it is difficult to do so as long as Parrot_clone() depends on freezing).

Well on first glance that comment seems to hark back to iThreads' "copy unshared data by default" nastiness... but on second reading (without better context) they're talking about PMCs that represent user code.

Fixup a PMC to be sharable. Right now, reassigns the vtable to one owned by some master interpreter, so the PMC can be safely reused after thread death.
I think it's clear that this comment pertains to the "shared everything" model rather than the "shared nothing model". It also sounds like exactly what I'd do for a "shared interpreter pool" scenario in a "shared everything" model.

In the future the PMC returned might be different than the one passed, e.g., if we need to reallocate the PMC in a different interpreter.
I definitely cannot devine any meaning from that one... what specifically about those words gives you pause?

In short, I definitely wouldn't interpret those comments (together or separately) to mean as you've concluded. I'd need much more context (and naturally to read the damn code) before I made any such conclusion.

Actually, if I must interpret those comments as a whole (a silly exercise at best), I get the following:

You see how I did that? ;) I got a completely different meaning from the same comments.

Seriously though, it's not like there's a CMM traceability document tying specific parts of the parrot implementation to words in the TDD... the parrot development has been highly incremental, striving for specific goals at each stage. I can only go by the discussion I read in the group's threads.

Larry (below) has put my mind at ease about perl6 wrt concurrency, so now I guess I'll just pay a bit more attention to the relevant groups to see what's really going on wrt concurrency in parrot.

-David

  • Comment on Re^3: Slow evolution of Perl = Perl is a closed Word (NQP, parrot concurrency == Oh dear.)

Replies are listed 'Best First'.
Re^4: Slow evolution of Perl = Perl is a closed Word (NQP, parrot concurrency == Oh dear.)
by BrowserUk (Patriarch) on Sep 11, 2007 at 03:59 UTC
    In the "shared everything" model, code that touches shared PMCs needs to be cloned into the offending thread.

    Ask yourself why? Why does anything need to be cloned? There is only one reason. Fork emulation.

    But if you have a real fork, you don't need to do that.

    And if you don't have a real fork, the fork emulation benefits nobody, because you do not have, and cannot provide, all the other bits that go with it.

    Signals for instance. Sure, Parrot could attempt to emulate signals as perl 5 has done, but it will only ever work for other parrot processes. You won't get a SIGCHLD when a non-perl child terminates because the OS doesn't do that. And that's just the tip of the iceberg.

    Fork emulation just doesn't work, and perpectuating it serves no good purpose.


    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.
      In the "shared everything" model, code that touches shared PMCs needs to be cloned into the offending thread.
      Ask yourself why?
      Firstly, what I wrote was pure speculation because I had no context at all.

      I'll play devil's advocate once more.

      Why does anything need to be cloned. There is only one reason. Fork emulation.
      I can think of at least two reasons:
      • the PMCs in question could be continuations
      • cloning could be done on a limited scale to promote affinity
      In reality I just don't know exactly how they're planning to support whats written in the PDD. In a perfectly ideal "shared everything" model nothing needs to be cloned... but what I got from reading the PDD is that you still need to protect certain structures to keep the Task PMCs and scheduler info consistent and free from corruption in the event that a thread dies.

      There is only one reason. Fork emulation ... But if you have a real fork, you don't need to do that.
      It does indeed look like they plan to provide some sort of fork()-like facility to platforms without it. I don't read anything else into it than that.

      Fork emulation just doesn't work, and perpectuating it serves no good purpose.
      Parrot has to run on multiple platforms, if you're going to provide the unix fork() via HLL APIs at all, you need to provide something similar to all platforms. Certainly, there will be costs associated with that on particular platforms.

      In any case, for an HLL you can use threads directly instead. perl5 specifically exposed unix fork() semantics, perl6 doesn't have to expose fork(). In that scenario I imagine it'll still be available by importing a module that knows how to do it using parrot APIs.

      -David

      Update: fixed a couple of typos.

        if you're going to provide the unix fork() via HLL APIs at all, you need to provide something similar to all platforms.

        Why?

        The perl 5 Win32 fork emulation is all but unusable. But worse, the result of its presence is that iThreading is close to unusable on every platform. It is, as of the last revision of threads, impossible to start a thread without everything that has already been loaded getting cloned. Need it or not.

        That means that starting a thread is slow; and each thread started is far heavier than it needs to be.

        You, and the PPD seem to be missing the fact that at the parrot level, everything is shared. Shared everything or shared nothing are execution models imposed upon the HLLs by the parrot runtime and the language implementations.

        Let's face it. This is a pointless discussion.


        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.