<html><body bgcolor="#FFFFFF"><div>By "API operation" I mean anything other than core ecmascript and localstorage itself. </div><div><br></div><div>Eg you can be sure that the following will not release the mutex:</div><div>* do nothing</div><div>* function call</div><div>* if/for etc</div><div>* access to a local variable</div><div>* access to a basic ecmascript object (not host objects)</div><div><br></div><div>But anything else outside core ecmascript is free to release the mutex if it wants. Eg any call to dom or any access to any object provided by the host. Rather than telling them what *can* release the mutex, we instead tell them to assume that everything can unless it is in our list of things that *can't*. </div><div><br></div><div>This is intentionally broad for several reasons:</div><div>* to avoid us having to work out the full list of all cases that could require any user agent to release the mutex</div><div>* to give users an easy rule that they can remember and know will always be safe on any user agent</div><div>* to give the user agent the freedom to release the mutex as soon as possible, thus improving concurrency [I am rep for Intel so I care about this] </div><div><br></div><div><br></div><div>Apologies for being vague earlier. </div><div><br>-Rob</div><div><br>On Nov 5, 2009, at 10:16 AM, Jeremy Orlow <<a href="mailto:jorlow@chromium.org">jorlow@chromium.org</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>This is intriguing. But what it comes down to is what we consider an "API operation". For example, you could define "API operation" to be the existing list of thing that unlock LocalStorage. Or it could be defined in a way that Darin Fisher's idea to lock whenever we're about to nest locking calls would also work. Or a variety of other things.<div>
<br></div><div>Does anyone have any ideas on what the exact language for what an "API operation" might look like?</div><div><br></div><div><br></div><div>I do have a couple of concerns though:</div><div>Leaving the language open might not be terribly useful to a typical web developer since they're not going to read the spec and probably aren't going to have a very firm idea of whether what they're doing could unlock storage or not. Experimentation wouldn't work very well since each platform could be wildly different (since a lot of possible behaviors fall between the MAY and the MAY NOT in the proposed spec).</div>
<div><br></div><div>Another concern is that the worst case performance aspects of LocalStorage remain. I cringe every time I think of one event loop blocking another. But I will admit that the average time would be better--especially if we're unlocking fairly aggressively.</div>
<div><br></div><div>I'm interested to hear what others have to say on this proposal.</div><div><br></div><div>J</div><div><br></div><div><br><div class="gmail_quote">On Wed, Nov 4, 2009 at 3:31 PM, Rob Ennals <span dir="ltr"><<a href="mailto:rob.ennals@gmail.com"><a href="mailto:rob.ennals@gmail.com">rob.ennals@gmail.com</a></a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Missed out the important final qualifier. Here's take 3:<br>
<br>
"the user agent MUST NOT release the storage mutex between calls to local storage, except that the user agent MAY release the storage mutex on any API operation /other that a local storage oeration/"<br>
<br>
If a local storage op can release the mutex then the whole thing is pointless :-)<br><font color="#888888">
<br>
-Rob</font><div><div></div><div class="h5"><br>
<br>
On Nov 4, 2009, at 3:15 PM, Rob Ennals <<a href="mailto:rob.ennals@gmail.com" target="_blank"><a href="mailto:rob.ennals@gmail.com">rob.ennals@gmail.com</a></a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I suspect my suggested spec line was insufficiently precise. How about this:<br>
<br>
"the user agent MUST NOT release the storage mutex between calls to local storage, except that the user agent MAY release the storage mutex on any API operation"<br>
<br>
We'd still need to define what "API operation" means, and I'm sure this could be worded better, but hopefully this makes the basic idea clearer.<br>
<br>
-Rob<br>
<br>
On Nov 4, 2009, at 2:56 PM, Mike Shaver <<a href="mailto:mike.shaver@gmail.com" target="_blank"><a href="mailto:mike.shaver@gmail.com">mike.shaver@gmail.com</a></a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, Nov 4, 2009 at 5:51 PM, Rob Ennals <<a href="mailto:rob.ennals@gmail.com" target="_blank"><a href="mailto:rob.ennals@gmail.com">rob.ennals@gmail.com</a></a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Or to put it another way: if the thread can't call an API then it can't<br>
block waiting for another storage mutex, thus deadlock can't occur, thus we<br>
don't need to release the storage mutex.<br>
</blockquote>
<br>
Right, but the spec text there doesn't prevent the UA from releasing<br>
more than in that scenario, which seems like it's not an improvement<br>
over where we are right now: unpredictable consistency. Existing racy<br>
implementations like in IE would be conformant, so developers can't<br>
count on the script-sequenced-storage-ops pattern providing<br>
transactionality.<br>
<br>
More likely, though, _I_'m missing something...<br>
<br>
Mike<br>
</blockquote>
<br>
</blockquote>
</div></div></blockquote></div><br></div>
</div></blockquote></body></html>