in reply to Re^5: choosing threads
in thread choosing threads

Please enlighten me; why perl threads are not lightweight?.

Vivek
-- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.

Replies are listed 'Best First'.
Re^7: choosing threads
by BrowserUk (Patriarch) on May 11, 2009 at 12:14 UTC

    Because, whereas in a compiled langauge each thread consists of little more than a set of cpu registers, a stack and an entry in the system scheduler tables; in Perl, you need those: plus a complete interpreter, plus per-interpreter copies of all non-entrant state.

    And as Perl began life as a single-threaded app, its internal state and control structures were never designed from the outset to be reentrant, which means there is of necessity, large volumes of per-thread duplication.


    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.