<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.Stylwiadomocie-mail17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor=white lang=PL link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>A very interesting post,
too bad nobody from Google bothered to give an exhaustive reply. Just a
couple of thoughts below.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>I think the problem
workers are trying to solve is quite practical. It is not about processing
power (desktop applications rarely use threads for that) and it is not about using
all computing resources available. Using workers makes sense even if the
browser is allowed to use only one CPU. In absence of an existing
implementation, developers try to get a similar functionality with setTimeout (requires
stackless code) and hidden windows. The current specification is an attempt
to make it cleaner and more robust.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>Problem statement: the
browser does not respond when it runs script code; it does not even update the
content area so it is not possible to indicate progress. Some useful
scripts can work for a long time, either because they are waiting for data
(directly or by periodically examining the document) or they are
computationally intensive (a much rarer phenomenon, but it still can happen in
interactive scientific publications, e.g. plotting a graph with parameters that
the user can adjust, or interactive fractals). <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>Aside: Scientists do not
call for threads in HTML because they are hardly acquainted with HTML, even
less with its bleeding edge. However, things may change when they see the
tool is right there and easy to use. Admittedly, Java can be used for the
purpose, but it has the didactical disadvantage that Java is a compiled
language and tweaking anything would require JDK. Besides, Java applets do
not run everywhere: they do not run in 64-bit Firefox for Linux (unless they
are very old).<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>The question about native
threads in JavaScript would be much better asked in a JavaScript forum. Workers
are an external mechanism provided by the host, not by the interpreter.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>If a Web browser, being a
desktop application, uses all processing resources from the operating system, either
it is the operating system that is at fault because it should not have allowed
this or the application uses a driver or a service in an unsupported way, which
probably means the driver or the service in question is to blame. I do
not think leaving one CPU free would help much in this case because there is no
guarantee the system process would use it anyway (it could end up being used by
something else).<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'>Chris<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-US
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt;color:windowtext'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight:bold'>From:</span></font></b><font
size=2 color=black face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
color:windowtext'> whatwg-bounces@lists.whatwg.org
[mailto:whatwg-bounces@lists.whatwg.org] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Shannon<br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, August 12, 2008
1:50 PM<br>
<b><span style='font-weight:bold'>To:</span></b> WHAT working group<br>
<b><span style='font-weight:bold'>Subject:</span></b> [whatwg] WebWorker
questions</span></font><font color=black><span style='color:windowtext'><o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
lang=EN-US style='font-size:12.0pt'>A few questions and thoughts on the
WebWorkers proposal:<br>
<br>
Is it wise to give a web application more processing power than a single CPU
core (or HT thread) can provide? </span>What stops a web page hogging ALL cores
(deliberately or not) and leaving no resources for the UI mouse or key actions
required to close the page? (This is not a contrived example, I have seen both
Internet Explorer on Win32 and Flash on Linux consume 100% CPU on several
occasions). I know it's a "vendor issue" but should the spec at least
recommend UAs leave the last CPU/core free for OS tasks?<br>
<br>
Can anybody point me to an existing Javascript-based web service that needs
more client processing power than a single P4 core?<br>
<br>
Shouldn't an application that requires so much grunt really be written in Java
or C as an applet, plug-in or standalone application? <br>
<br>
If an application did require that much computation isn't it also likely to
need a more efficient inter-"thread" messaging protocol than passing
Unicode strings through MessagePorts? At the very least wouldn't it usually
require the passing of binary data, complex objects or arrays between workers
without the additional overhead of a string encode/decode?<br>
<br>
<br>
<o:p></o:p></font></p>
</div>
</body>
</html>