On Wed, Jan 11, 2012 at 7:01 PM, Mike Meyer <span dir="ltr">&lt;<a href="mailto:mwm@mired.org">mwm@mired.org</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Wed, 4 Jan 2012 00:07:27 -0500<br>
PJ Eby &lt;<a href="mailto:pje@telecommunity.com">pje@telecommunity.com</a>&gt; wrote:<br>
 &gt; On Tue, Jan 3, 2012 at 7:40 PM, Mike Meyer &lt;<a href="mailto:mwm@mired.org">mwm@mired.org</a>&gt; wrote:<br>
</div><div class="im">&gt; &gt; For</div><div class="im">
&gt; &gt; instance, combining STM with explicit locking would allow explicit<br>
&gt; &gt; locking when IO was required,<br>
&gt; I don&#39;t think this idea makes any sense, since STM&#39;s don&#39;t really<br>
&gt; &quot;lock&quot;, and to control I/O in an STM system you just STM-ize the<br>
&gt; queues. (Generally speaking.)<br>
<br>
</div>I thought about that. I couldn&#39;t convince myself that STM by itself<br>
sufficient. If you need to make irreversible changes to the state of<br>
an object, you can&#39;t use STM, so what do you use? Can every such<br>
situation be handled by creating &quot;safe&quot; values then using an STM to<br>
update them?<br></blockquote><div><br></div><div>If you need to do something irreversible, you just need to use an STM-controlled queue, with something that reads from it to do the irreversible things.  The catch is that your queue design has to support guaranteed-successful item removal, since if the dequeue transaction fails, it&#39;s too late.  Alternately, the queue reader can commit removal first, then perform the irreversible operation...  but leave open a short window for failure.  It depends on the precise semantics you&#39;re looking for.</div>
<div><br></div><div>In either case, though, the STM is pretty much sufficient, given a good enough queue data structure.</div></div>