<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 8, 2015 at 6:27 PM, Craig Latta <span dir="ltr">&lt;<a href="mailto:craig@netjam.org" target="_blank">craig@netjam.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
&gt; Well, I threw a (ProcessorScheduler<br>
<span class="">&gt; relinquishProcessorForMicroseconds: 100) into one of the successful<br>
&gt; vm-thread callbacks, and now the foreign-thread callback hangs waiting<br>
&gt; for the ioWaitOnOSSemaphore() in ownVM(). So I&#39;m not too confident<br>
</span>&gt; that fixing the bug in cedeToHigherPriorityThreads and/or<br>
<span class="">&gt; threadSwitchIfNecessary:from: will get me moving again. But I&#39;ll bang<br>
&gt; on it anyway, I guess.<br>
<br>
</span>     I also notice that, at the point where things just start spinning,<br>
I&#39;ve got four threads, three of which (interpreter loop, thread<br>
scheduling loop, foreign callback thread) are waiting on VM thread<br>
semaphores. How is the other thread, the heartbeat thread, supposed to<br>
get things moving?<br></blockquote><div><br></div><div>The only rôle the heartbeat thread has in multithreading is spotting when the VM is unowned and starting off a thread to take ownership.  e.g. some long-running callout occurs, which first disowns the VM.  It is the heartbeat which spots that the VM is unowned and it might be sensible to start another thread to try and run the VM, hence not slowing down the callout by having it start a thread on each callout.</div><div><br></div><div>What&#39;s supposed to stop the threads spinning is proper interaction between them.  that this isn&#39;t happening is a bug.  As I said, this is a prototype work in progress.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
-C<br>
<br>
--<br>
Craig Latta<br>
<a href="http://netjam.org" rel="noreferrer" target="_blank">netjam.org</a><br>
<a href="tel:%2B31%20%20%206%202757%207177" value="+31627577177">+31   6 2757 7177</a> (SMS ok)<br>
<a href="tel:%2B%201%20415%20%20287%203547" value="+14152873547">+ 1 415  287 3547</a> (no SMS)<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>