From: Stefan Weiss on 9 Mar 2010 08:00 On 09/03/10 09:52, Jorge wrote: > On Mar 9, 12:26 am, Stefan Weiss <krewech...(a)gmail.com> wrote: >> AFAIK, all browser script engines have a single main thread, but >> recently various implementations of background threads have surfaced >> (web workers), which effectively makes JS development on these browsers >> potentially multi-threaded. The main difference to most other >> multi-threaded platforms is that one thread is privileged (i.e., has >> full access to the DOM), while the other threads are intended for >> secondary, background calculation tasks. They communicate via a message >> passing system instead of sharing access to variables and properties, >> which more or less bypasses the need for synchronization. > > Yep. But -just nitpicking a little bit- you prolly shouldn't really > call a worker a thread as it shares no context with its parent. It's a > completely separate process with a completely independent separate JS > context with which you communicate only via JSON texts -messages- > passing. Could be a thread, could be a process; it depends on the implementation. The WHATWG document calls it a "thread-like operation with message-passing as the coordination mechanism" and requires a "completely separate and parallel execution environment (i.e. a separate thread or process or equivalent construct)." -- stefan |