[whatwg] [WebWorkers] Maximum number of workers (was "About the delegation example")

David Bruant bruant at enseirb-matmeca.fr
Mon Dec 7 13:39:31 PST 2009


David Bruant :
> "In the delegation example, the number of workers chosen is an arbitrary 
> 10. But, in a single-core processor, having only one worker will result 
> in more or less the same running time, because at the end, each worker 
> runs on the only core."
>   
Ian Hickson :
"That depends on the algorithm. If the algorithm uses a lot of data, then 
a single hardware thread might be able to run two workers in the same time 
as it runs one, with one worker waiting for data while the other runs 
code, and with the workers trading back and forth.

Personally I would recommend basing the number of workers on the number of 
shards that the input data is split into, and then relying on the UA to 
avoid thrashing. I would expect UAs to notice when a script spawns a 
bazillion workers, and have the UA run them in a staggered fashion, so as 
to not starve the system resources. This is almost certainly needed 
anyway, to prevent pages from DOSing the user's system."

=> Wouldn't it be preferable to have an implementation-dependant "maximum number of workers" and to raise a security exception when this number is reached ? Maximum per domain ? per document ?
Maybe a different maximum for shared and dedicated workers.

Any opinion on this ?

David




More information about the whatwg mailing list