[whatwg] [WebWorkers] About the delegation example
David Bruant
bruant at enseirb-matmeca.fr
Fri Nov 6 14:41:15 PST 2009
ben turner a écrit :
> I think it's important to note that there is no guarantee that each
> worker is tied to an actual OS-level thread. Firefox, for instance,
> will schedule workers on a limited number of OS threads to prevent
> resource swamping. Other implementations (Chromium only?) create new
> processes to run worker code. The only guarantee is that code executed
> in a worker will not block the main thread.
>
I didn't know the differences between the current web workers
implementations and that's interesting.
The problem with developing JS code using Web workers in a delegation
use case is that you cannot predict what is the hardware, the OS and the
browser you will run your code on. So, what is the "right", "best"
number of workers to use ? 1, 10, 16, 1000 ? It is not a defined number,
it depends on hardware, OS and browser (or any user agent, of course).
My point is to give this information to the developer.
If FF decides that all the workers will run on 3 OS threads even if
you're on a 16-core, my number is 3. If you're in Chrome and your OS
allows you to create only one more process, this number is 1. If you're
in Chrome and your OS allow you to create "as many processes as you
want" on a quad-core, this number is 4. But for each case, the web
browser can ask this information to the OS (once when you install it ?
each time you open your browser ? dynamically ?).
This information is available (and shouldn't be that hard to retrieve !)
and can be given to the web developer.
David
> -Ben
>
More information about the whatwg
mailing list