Hello.
I'm new to V8. I've taken a look at some source code but everything is 
still pretty confusing now.

I'd like to implement a simple loop parallelizer on top of V8. I'm 
currently targeting very simple kinds of loops.
For example, let's assume 'myarray' contains 100 0s. Then
for (i = 0; i < 100; i++) {
  myarray[i] = i;
}
Each iteration of the loop above is independent in the loop above, and in 
C-like languages, parallelizing tools such as OpenMP can execute this loop 
in multiple threads (and in multiple cores) for better speedup. I'd like to 
do a similar thing on top of V8. I'm thinking of implementing it on 
Crankshaft code, because this kind of optimization is effective only if a 
loop is not anyway.

Let's say, I want to use four cores in my system, so four threads to run 
this loop. Each thread can run in parallel, but sometimes they need to 
communicate. How can I achieve this? If it is not really well supported by 
V8 as is, I don't mind hacking on it. Followings are the various options I 
am thinking:
1. Use multiple Isolates and create a communication channel (like software 
queue or something) between them, because AFAIK communication between 
Isolates does not seem to be supported.
2. Use one Isolate and multiple Contexts within it, and run each Context in 
a different thread. I'm not sure if this is even possible, though.
3. Use multiple WorkerThreads to achieve this. 
(By the way, there are v8::Worker::WorkerThread and 
v8::platform::WorkerThread, and it looks like v8::platform::WorkerThread is 
used by background jobs like compilation, and v8::Worker::WorkerThread is 
used by web workers. Right? I'm not even sure which one I need between 
these two.)
4. Don't mess with Isolates or Contexts or Workers and just implement 
threading routines in Crankshaft-generated jitted code directly.

I think I need to dig into the source code more deeply to understand the 
overall structure, but any advice would be really helpful in the current 
stage because I'm pretty new to all this.
Thank you.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
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 v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to