On a related note - does it make sense to integrate futures with the events framework? <br><br>Seems like touch is similar to sync.<br><br>Cheers,<br>yc<br><br><div class="gmail_quote">On Sun, Dec 13, 2009 at 7:57 AM, James Swaine <span dir="ltr">&lt;<a href="mailto:james.swaine@gmail.com">james.swaine@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Right.  You won&#39;t have the problem Sam talks about where you&#39;ve forced a computation to finish on a separate OS thread than the one you originally started on.  Code in a future will always execute on the same OS thread (except for the unsafe primitive invocations), even if you touch it before it&#39;s finished.  In that case, the runtime OS thread will do whatever unsafe work was blocking the future, then signal the future OS thread that it can resume.  Then the runtime OS thread blocks waiting for the future thread to terminate (or ask for another primitive invocation).<br>

<br>One thing to worry about is touching a future before a parallel thread has had a chance to discover it, in which case the whole future will actually be run on the runtime thread.  I don&#39;t think this would really ever be a problem in practice, however, because if your code wants to touch the future that quickly, you probably didn&#39;t need to do the computation in parallel in the first place.<br>

<br>The operating system can arbitrarily decide to move threads from one processor to another but there&#39;s little we can do about that.  We can use affinity masking to politely suggest that the OS keep threads bound to specific processors/cores, but even then it&#39;s still <br>

free to schedule them however it wants.<br><font color="#888888"><br>-James <br></font><div><div></div><div class="h5"><br><div class="gmail_quote">On Sun, Dec 13, 2009 at 9:10 AM, Robby Findler <span dir="ltr">&lt;<a href="mailto:robby@eecs.northwestern.edu" target="_blank">robby@eecs.northwestern.edu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>On Sun, Dec 13, 2009 at 8:40 AM, Sam TH &lt;<a href="mailto:samth@ccs.neu.edu" target="_blank">samth@ccs.neu.edu</a>&gt; wrote:<br>


&gt; I thought that when a future gets `touch&#39;ed, if<br>
&gt; it isn&#39;t finished, the remainder of the computation runs in the<br>
&gt; continuation (and thus thread) of the `touch&#39;.  If I&#39;m wrong about<br>
&gt; that, then my worries are assuaged.<br>
<br>
</div>That&#39;s roughly what happens when the future was blocked (technically,<br>
it does some rendez vous with the runtime thread instead of copying<br>
the state over, but that&#39;s something that shouldn&#39;t really matter from<br>
the api level), but when the future is not blocked, it just keeps<br>
running merrily along.<br>
<font color="#888888"><br>
Robby<br>
</font></blockquote></div><br>
</div></div><br>_________________________________________________<br>
  For list-related administrative tasks:<br>
  <a href="http://list.cs.brown.edu/mailman/listinfo/plt-dev" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-dev</a><br>
<br></blockquote></div><br>