W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2009

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

From: David Bruant <bruant@enseirb-matmeca.fr>
Date: Mon, 07 Dec 2009 13:39:31 -0800
Message-ID: <4B1D7613.8080508@enseirb-matmeca.fr>
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
Received on Monday, 7 December 2009 13:39:31 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:54 UTC