About multi-threading in V8

2,174 views
Skip to first unread message

Luc

unread,
Sep 3, 2008, 5:41:14 AM9/3/08
to v8-users
Hello,

How multi-threading works on V8 engine. Is it needed to use different
contexts or can we share object between different thread safely ?
What kind of precautions should we take when embedding V8 engine in an
heavy multi-threaded application ?

Regards,

Luc

Erik Corry

unread,
Sep 3, 2008, 7:27:00 AM9/3/08
to v8-users
There's a section in include/v8.h which explains the mechanisms.
Search for 'Locker'. Basically, V8 can use multiple threads, but only
one at a time, so you cannot have Javascript actually executing on
more than one CPU at a time unless you have several processes.

Feng Qian

unread,
Sep 3, 2008, 10:20:56 AM9/3/08
to v8-u...@googlegroups.com
I try to explain what I knew. The only mechanism V8 provides is the Locker class which has a StartPreemption function. Most internal data of V8 are not thread-safe. So I'd say it is co-operative multi-threading. Gears in Chrome uses V8 in the multi-threading environment.

i3x1...@gmail.com

unread,
Sep 3, 2008, 1:36:04 PM9/3/08
to v8-users

huangyi

unread,
Sep 4, 2008, 2:04:03 AM9/4/08
to v8-users
Just like CPython's GIL .

On Sep 4, 1:36 am, i3x17...@gmail.com wrote:
> See my post in:http://groups.google.com/group/v8-users/browse_thread/thread/3f66bb4c...
Reply all
Reply to author
Forward
0 new messages