Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: perl5 road map?

by BrowserUk (Pope)
on Mar 24, 2012 at 15:27 UTC ( #961413=note: print w/ replies, xml ) Need Help??


in reply to Re^2: perl5 road map?
in thread perl5 road map?

The thing is that in Erlang ... create processes (it doesn't have threads)

Sorry, but you are wrong. Erlang does use threads.

  • Firstly: Erlang processes are actually 'green threads'.

    That is, user-space execution contexts, running in shared memory space, managed by an custom-written, in-process scheduler.

  • Secondly: Since the release of R13B in 2006; as a result of the realisation that green threading didn't scale on modern hardware -- whether multi-processor SMP or multi-core SMP or a combination of the two -- Erlang now uses kernel threads internally, in order to achieve scalable concurrency.

    For a little more detail of the history and reasoning, please see one I prepared earlier.

    And see the Erlang development team paper: "Inside the Erlang VM: with focus on SMP. Prepared by Kenneth Lundin, Ericsson AB Presentation held at Erlang User Conference, Stockholm, November 13, 2008 ". (I linked to the PDF in the earlier reference.)

here's an example from Erlang Programming that creates 10000 processes (in the book they actually starting at 100000):

Yes. And the Go language proponents promote that it can do the same thing:

package main import ("flag"; "fmt") var ngoroutine = flag.Int("n", 100000, "how many") func f(left, right chan int) { left <- 1 + <-right } func main() { flag.Parse(); leftmost := make(chan int); var left, right chan int = nil, leftmost; for i:= 0; i< *ngoroutine; i++ { left, right = right, make(chan int); go f(left, right); } right <- 0; // bang! x := <-leftmost; // wait for completion fmt.Println(x); // 100000 }

The Mercedes CLK63 AMG Black has so much power that Jeremy Clarkson (Top Gear) managed to sustain a power-slide for so long that he completely destroyed a brand new pair of 1,000/pair rear tyres in about 10 minutes. It was spectacular to watch; and I bet it was fun to do; but as a measure of the utility of the vehicle, it is entirely pointless!

And the same goes for both the Erlang and Go threading demos. They are entirely useless as demonstrations of anything practical or useful.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.

The start of some sanity?


Comment on Re^3: perl5 road map?
Download Code
Re^4: perl5 road map?
by zwon (Monsignor) on Mar 24, 2012 at 17:20 UTC

    Erlang processes don't share anything, hence they actually different from 'green threads' like in Java, you can't rewrite your example with threads::shared in Erlang (and I mean using shared variable). VM itself indeed implemented with using threads, but they are not visible for Erlang programs, and don't map to Erlang processes.

    And the same goes for both the Erlang and Go threading demos. They are entirely useless as demonstrations of anything practical or useful.

    Agreed. So why the hell you first gave useless demonstration in Perl, then asked Let's see your Erlang one-liner, and finally thrown up even more useless Go? ;)

      Erlang processes don't share anything, hence they actually different from 'green threads'

      Of course they share stuff. It is an illusion of the programing model -- functional programming with single assignment variables -- that they appear not to. But just as they don't throw away a chunk of ram just because you used it once, there is nothing to stop errant (compiler or runtime) code scribbling all over everything in the process virtual memory space.

      Everything lives in a single process; ergo, everything is shared.

      So why the hell you first gave useless demonstration in Perl,

      Because the OP said: "who determine if ... perl5? For example: can create 1000+ fast,light, reliable threads easily without any crash like erlang"

      I simply demonstrated that it was possible to do that now, and had been possible for a long time.

      But I went on to say: "Of course, I cannot actually think of a valid use for it, but doing it is not a problem."

      My exact point was that it is just as useless to do in Perl as it is in Erlang or Go -- but if you want to, you can.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      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.

      The start of some sanity?

        be a little late to join this discussion, but zwon's comment is most of what I wanna say, I would be more polite tho. jk ;)

        Even as a multi-process model, perl5's ithreads is still not good enough. copying every thing to new thread/process is insane to me.(refer to this ) As a perl fan, I just hope perl would have some more weapons to compete

        In short for threading thing, if you meet a scenario for heavy multi-threading, consider other languages(Erlang, GO like BrowserUk said) or XS other than pure perl.

        UPDATE Fixed this link, Thank Happy-the-monk





        I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://961413]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-11-26 23:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (177 votes), past polls