ecmascript should support multi-threads
quildreen at gmail.com
Sun Jan 12 09:26:26 PST 2014
The idea of having shared mutable state in a language is a horrifying one.
We *do not* need threads for parallelism, and scaling in to use multiple
cores. In Browsers, we can already have isolated parallelism through
WebWorkers, which means that we can safely use all the cores in a machine
without the need of locks, and the possibility of deadlocks. Currently,
communicating between these workers is slow because you need to pay the
price of serialisation, but they work well for things that don't need to
communicate so often.
Value classes are planned for ES7, once they're in WebWorkers will be able
to efficiently share data between different workers, without the need for
locks and the possibility of deadlocks. This is both safer and faster (due
to the immutability of the data). As soon as v8 supports Value Classes,
Node will be able to leverage then to make parallelism a no-brainer. Until
then, the cluster module is the best you'll get.
Note that this will also allow us to get the same distributed semantics as
Erlang/OTP: isolated processes, crash-only systems with custom supervising
strategies. And that's a really awesome thing for writing robust and
reliable distributed/parallel systems :)
On 12 January 2014 13:59, Andrea Giammarchi <andrea.giammarchi at gmail.com>wrote:
> if you are talking about node.js there have been recent improvements to
> the cluster module.
> I've used cluster even in Cubieboard2 and it works quite well using as
> many resources as possible if specified.
> Maybe that won't make JS like Java (thank Gosh!) but combined with linear
> and async callbacks it does a very good job.
> Hope this helped,
> best regards.
> On Sun, Jan 12, 2014 at 5:26 AM, 紫诡 <1511569466 at qq.com> wrote:
>> it's nouseful in brower.
>> but, if engine in server, like node.js , it's will be need. although, we
>> can use non-blocking
>> API to do it, but it can't support multi cpu env well good.
>> Manager API , it will like Java Language
>> es-discuss mailing list
>> es-discuss at mozilla.org
> es-discuss mailing list
> es-discuss at mozilla.org
Quildreen "(Soreλ\a)" Motta
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss