in reply to Re^3: 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

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.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."
  • Comment on Re^4: Slow evolution of Perl = Perl is a closed Word (NQP, parrot concurrency == Oh dear.)

Replies are listed 'Best First'.
Re^5: Slow evolution of Perl = Perl is a closed Word (NQP, parrot concurrency == Oh dear.)
by erroneousBollock (Curate) on Sep 11, 2007 at 05:05 UTC
    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.