<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 25 October 2013 01:39, John McIntosh <span dir="ltr">&lt;<a href="mailto:johnmci@smalltalkconsulting.com" target="_blank">johnmci@smalltalkconsulting.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr">After you solve <span style="font-family:Menlo;font-size:11px">aioPoll()</span><div><span style="font-family:Menlo;font-size:11px"><br>
</span></div><div>You could consider waiting in the morphic polling loop until a VM UI event interrupt comes in, or to when you need to wake up to service your Morphic responsibilities. <br>
</div></div><div class="gmail_extra"><br></div></blockquote><div><br>you always know when image wants to wake up - it is a delay semaphore.<br></div><div>basically , when image sets new Delay, it says to VM: wake me up at this moment.<br>
</div><div>This is i think the only thing, of course aside the async i/o &amp; UI events.<br></div><div><br></div><div>I don&#39;t know how well different platforms support that,<br></div><div>but at least on windows, a following can be realized without the problem:<br>
<br></div><div>self primPleaseWakeMeUpWhenSomethingHappensButNotForNoReason<br></div><div><br>instead of:<br><br></div><div>[ self sleep:1000 &quot;or wakeup if there something happens&quot; ] repeat.<br><br></div><div>means, that OS Kernel can handle that and it halts CPU for your process until hardware interrupt arrives.<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 24, 2013 at 7:34 PM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com" target="_blank">siguctua@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 25 October 2013 01:18, John McIntosh <span dir="ltr">&lt;<a href="mailto:johnmci@smalltalkconsulting.com" target="_blank">johnmci@smalltalkconsulting.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr">Well let me reflect.<div>Nothing has changed, the VM energy sapping field is the same as  yesterday, just more evident. </div>


<div><br></div><div> I wasn&#39;t able to determine what code base is used, but if I go back 5 or 10 years.</div>

<div><br></div><div>(a) The morphic event polling cycle runs 50 times a second. One could write some timer consolidation code there to consider when do I have to wake up and paint all those morphs? No C/Objective-C/assembler/fortran required... </div>



<div><br>
</div><div>(b) Maybe the VMs are event driven now and Morphic does not need to poll 50 times a second? </div><div><br></div><div>(c) The BSD Unix socket system requires polling of some form.  But see work by Craig 10-15 back on &quot;Flow&quot;</div>




<div><br></div><div>(d) When all the Smalltalk Processes settle, the dispatcher runs the lowest priority task which calls <span style="font-family:arial,sans-serif;font-size:13px">relinquishProcessorForMicrosec</span><span style="font-family:arial,sans-serif;font-size:13px">onds with a bogus value. </span></div>



<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div></blockquote><div><br>(e) Cog uses heartbeat timer to interrupt interpreter at regular time periods <br></div><div>what can be done, i think it to suppress heartbeat, during <span style="font-family:arial,sans-serif;font-size:13px">relinquishProcessorForMicrosec</span><span style="font-family:arial,sans-serif;font-size:13px">onds execution.<br>


</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">but that won&#39;t buy much, unless we increase the time period to sleep to be times larger than heartbeat cycle (both are 1ms).<br><br>sqMacV2Time.c:<br>


<br>sqInt ioRelinquishProcessorForMicroseconds(sqInt microSeconds) {<br>    //API Documented<br>    /* This operation is platform dependent.      */<br>    #pragma unused(microSeconds)<br><br>    sqInt       realTimeToWait,now,next;<br>


    extern sqInt getNextWakeupTick(void);                //This is a VM Callback<br>    extern sqInt setInterruptCheckCounter(sqInt value);  //This is a VM Callback<br><br>    setInterruptCheckCounter(0);<br>    now = ioMSecs();<br>


    next = getNextWakeupTick();<br>    <br>    /*BUG??? what if clock wraps? */<br>    <br>    if (next &lt;= now)<br>        if (next == 0)<br>                realTimeToWait = 16;<br>            else {<br>                return 0;<br>


            }<br>        else<br>            realTimeToWait = next - now; <br><br>    aioSleep((int) realTimeToWait*1000);<br>    return 0;<br>}<br><br><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">The real solution would be to not fall asleep,<br>


</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">but just put process into waitable state on &#39;wake up semaphore&#39;<br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">which then signaled if there&#39;s some i/o or timeout.<br>


<br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><span style="font-family:arial,sans-serif;font-size:13px"></span></div>


<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 24, 2013 at 6:21 PM, tim Rowledge <span dir="ltr">&lt;<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Looking through some of the low-level changes in Mavericks I noticed stuff about timer consolidation. I *think* that it is something that you can offer to allow, rather than something done unto you code, but almost certainly it will have some sort of impact on the heartbeat ticker type of code used in stackvm/cog. Where is a skilled Mac vm maintainer when you need one?<br>




<br>
tim<br>
--<br>
tim Rowledge; <a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" target="_blank">http://www.rowledge.org/tim</a><br>
&quot;bOtHeR&quot; said Pooh, mistaking the LSD tablet for aspirin<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>===========================================================================<br>John M. McIntosh &lt;<a href="mailto:johnmci@smalltalkconsulting.com" target="_blank">johnmci@smalltalkconsulting.com</a>&gt;<br>



Corporate Smalltalk Consulting Ltd. Twitter: squeaker68882<br>===========================================================================<br><br>
</div>
<br></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Igor Stasenko.
</div></div>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>===========================================================================<br>John M. McIntosh &lt;<a href="mailto:johnmci@smalltalkconsulting.com" target="_blank">johnmci@smalltalkconsulting.com</a>&gt;<br>

Corporate Smalltalk Consulting Ltd. Twitter: squeaker68882<br>===========================================================================<br><br>
</div>
<br></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Igor Stasenko.
</div></div>