There are multiple levels of garbage collection (v8 object heap and C 
runtime heap) that are not thread-safe.  Furthermore, you'll need to 
implement some kind of language extension so programmers can indicate which 
loops should execute in parallel, as well as some kind of synchronization 
(ie: mutexes) or atomic read-modify-write (ie: CAS, FAA) operations to 
implement thread safe access of global variables.

Assuming you solve those problems, you then face the challenge of finding 
enough parallel work to amortize the overhead of scheduling, 
synchronization, and load imbalance.  Remember Amdahl's law 
<https://en.wikipedia.org/wiki/Amdahl%27s_law> -- if a program spends 15% 
of it's time in initialization orchestrating parallel work and distributing 
data to tasks, and 15% of it's time collecting and outputting the results, 
that program cannot even reach a 4x speedup.  To achieve good parallel 
efficiency, single iterations must take long enough to amortize the 
overhead, which effectively eliminates any kind of fine-grained 
parallelization, which eliminates the need to implement parallelism *inside* 
v8.

                -J


On Friday, February 26, 2016 at 4:07:35 PM UTC-8, Tiny Wings wrote:
>
> Thank you very much for your answer.
> Could you let me know what those showstoppers are?
> And I don't have any experience with Node and I'm not intending to build a 
> web server either. Is Node easier to use than native V8 for parallelization?
>
> Thank you.
>
> On Tuesday, February 23, 2016 at 1:31:55 PM UTC-5, 
> [email protected] wrote:
>>
>> I, too, looked at adding OpenMP to v8 but there are several showstoppers 
>> to adding parallelism *inside* v8.  My solution was to add shared, 
>> persistent objects as a native addon, and fork multiple instances of Node 
>> for concurrency.
>>
>> The native addon prevents this from being used in browsers, but this 
>> approach works embedded in systems with POSIX-like shared memory: EMS.js 
>> home page <http://syntheticsemantics.com/EMS.js/>, GitHub 
>> <https://github.com/SyntheticSemantics/ems>
>>
>>           -J
>>
>>
>> On Monday, February 22, 2016 at 11:34:38 PM UTC-8, Tiny Wings wrote:
>>>
>>> About my question:
>>> This is actually not really much about parallelization; this is rather 
>>> about how to do launch multiple threads in multiple cores within a 
>>> javascript program and make them communicate when needed.
>>>
>>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to