JavaScript multithreading

Posted by Krzysztof Hasinski on Stack Overflow See other posts from Stack Overflow or by Krzysztof Hasinski
Published on 2011-10-03T18:42:22Z Indexed on 2012/12/08 11:08 UTC
Read the original article Hit count: 351

I'm working on comparison for several different methods of implementing (real or fake) multithreading in JavaScript. As far as I know only webworkers and Google Gears WorkerPool can give you real threads (ie. spread across multiple processors with real parallel execution). I've found the following methods:

  • switch between tasks using yield()

  • use setInterval() (or other non-blocking function) with threads waiting one for another

  • use Google Gears WorkerPool threads (with plugin)

  • use html5 web workers

I read related questions and found several variations of the above methods, but most of those questions are old, so there might be a few new ideas.

I'm wondering - how else can you achieve multithreading in JavaScript? Any other important methods?

UPDATE: As pointed out in comments what I really meant was concurrency.

UPDATE 2: I found information that Silverlight + JScript supports multithreading, but I'm unable to verify this.

UPDATE 3: Google deprecated Gears: http://code.google.com/apis/gears/api_workerpool.html

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about multithreading