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".
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|