[whatwg] [Web workers] An attribute describing the "best" number of worker to invoke in a delegation use case

Boris Zbarsky bzbarsky at MIT.EDU
Thu Nov 12 16:35:39 PST 2009


On 11/12/09 7:24 PM, David Bruant wrote:
> =>  I think it happens very often. While I'm writing this e-mail, "no
> process" is running. About fifty processes are runnable, but not
> running. They are passively waiting. My CPU is barely used.

Interesting.  I have several browser processes using timeslices right 
now (the incessant XHR google apps tend to do, I think), plus at least 
two other things running that are fully using up one core and most of 
another, as I write this mail.

I don't see how a browser could return a single number that would "work" 
or both of us.

> My point is that this number may be available very easily. For example,
> in my dual-core, Linux, Firefox 3.5, the number is 2.

OK, what about in Firefox 3.6?  If your worker plans to not allocate 
many strings and the like, it's 2.  Otherwise, it's 1 (because a good 
bit of gc finalization has been moved to a separate thread).

> Why spare an information that can be useful and reliable (more than measurement at
> least !) ?

Because the information is _not_ reliable.  The optimal number of 
concurrent threads of execution given a given fixed set of computation 
resources is heavily dependent on the behavior of the threads of 
execution and what else is using the computation resources...

Put another way, as a UA implementor I don't know what I'd make this 
attribute return without it being a bald-faced lie in pretty simple cases.

> =>  Yes and no. No one can know if they will be optimally used or not.
> What you are "garanteed" (quotes again) is that in "blank conditions",
> they will be optimally used (which is more or less the definition of
> this number).

See above; even in "blank conditions" this may well depend on the exact 
workload of your workers.

-Boris



More information about the whatwg mailing list