[whatwg] WebWorkers and images

Boris Zbarsky bzbarsky at MIT.EDU
Fri Jan 7 09:05:32 PST 2011

On 1/7/11 10:25 AM, Berend-Jan Wever wrote:
> - a single WebWorker always runs in only one thread, even though there may
> be multiple WebWorkers running on the same thread, right?

No.  For example, in Gecko a given webworker only runs on one thread at 
any given moment, but that thread can change over time.  In particular, 
when a worker goes idle it's put back in the general idle worker pool; 
when a worker is pulled from the the pool because it has work to do it's 
assigned to whatever thread is free in the worker threadpool.  This 
allows having fewer live threads than possibly-executing workers without 
having to pin workers to a particular thread and hence without having to 
block workers on other totally unrelated workers that happened to be 
"assigned to the same thread".

> - it should be possible to give each WebWorker its own DOM instance, like
> various webpages running in one process have their own DOM instance as well,
> right?

Webpage DOM instances share various global-ish data.  Certainly in Gecko 
they do.

So you're proposing a quite different separation from the one between 
webpages in one process.  Multiple processes might be closer to it.

> - Assuming that the DOM instances aren't shared between the WebWorkers or
> with the web pages, there can be no re-entrancy issues, right?

Wrong, sorry.  See above.


More information about the whatwg mailing list