<html><head></head><body bgcolor="#FFFFFF"><div>I tried suspending the watchdog thread on sleep and got mixed results if it bade a difference as suspend/resume takes time. However someone is welcome to try that again and produce some numbers&nbsp;<br><br>Sent from my iPhone</div><div><br>On Jun 7, 2012, at 1:24 PM, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div><span></span></div></blockquote><blockquote type="cite"><div><br><br><div class="gmail_quote">On Wed, Jun 6, 2012 at 7:07 PM, 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">
&nbsp;<br>I've resisted reponding, but way less busy tonight.&nbsp;<div><br></div><div>Ok, in general pre-cog as I can't quite comment about how that works.&nbsp;</div><div><br></div><div>After most things are killed there is really only the Morphic polling loop running.&nbsp;</div>

<div>What happens is it attempts about 50 times a second to wake up and service morphic steps and collect VM events and turn them into mophic events.&nbsp;</div><div>That of course takes CPU.&nbsp;</div><div><br></div><div>Now when the morphic poll loop goes to sleep by scheduling a variable length delay to met the 50 times a second, what happens is what Igor alluded to&nbsp;</div>

<div>some other process has to run otherwise the VM will terminate with no processes to run.</div><div><br></div><div>This process is the lowest level idle process. &nbsp;</div><div>What it does is get passed a FAKE millisecond time.&nbsp;</div>

<div>Note in the previous century I attempted to pass how log to sleep as the Delay logic knows that... But we found out after it was pushed to the squeak change stream that there was a deadlock... Oops.&nbsp;</div><div><br></div>

<div>Later I realized we know in the VM when the next wakeup time is.&nbsp;</div><div><br></div><div>So in the VM when it calls the primitive to do idle time sleep we can grab the next known wakeup time and sleep until then.&nbsp;</div>

<div>or until some interrupt happens, like a file system, socket, UI input wakes us up early.&nbsp;</div><div>Then we usually on unix run the async file handle logic to deal with pending semaphores for sockets etc.&nbsp;</div><div>

That all sounds fairly rational, until you instrument and discover things like you are asked to sleep, yet a delay a millisecond or two in the past needs to be serviced...&nbsp;</div><div>You'll need to look at the platform support code to understand what happens, 50 times a second..&nbsp;</div>

<div>&nbsp;</div><div><br></div><div>I think for COG there is also a high priority millisecond tick process running to update the millisecond/microsecond clock? &nbsp;That spins the CPU dial too.</div></blockquote><div><br></div><div>
Yes, but only when the VM is running. &nbsp;It *doesn't* need to run if the VM is blocked sleeping. &nbsp;And the overhead of this watchdog thread is very low. &nbsp;Don't confuse the watchdog thread with not blocking for i/o when at idle. &nbsp;There's nothing to stop one disabling the watchdog during idle, provided scheduled delays break out of idle.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div><br><div class="gmail_quote">
On Wed, Jun 6, 2012 at 9:37 PM, Phil (list) <span dir="ltr">&lt;<a href="mailto:pbpublist@gmail.com" target="_blank">pbpublist@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>
Igor,<br>
<div><br>
On Jun 6, 2012, at 2:24 PM, Igor Stasenko wrote:<br>
<br>
&gt;<br>
&gt; just kill an idle process.<br>
&gt; but you must be sure that at any moment of time there will be some<br>
&gt; scheduled process<br>
&gt; available, otherwise VM will leave to OS, since it will unable to find<br>
&gt; anything to run<br>
&gt;<br>
<br>
</div>I'm not sure I understand: I have a morph with stepping enabled (every 50ms)... shouldn't that keep the idle process from taking over? &nbsp;If not (i.e. and your suggestion is the way to go), what's the recommended way to kill the idle process and how would I restart it when I no longer want maximum performance?<br>


<br>
The link to the image I posted in my reply to Bert will also display the behavior I'm describing: simply moving the mouse around while the stepping is active will increase the framerate, when you stop moving the mouse it decreases.<br>


<div><br>
&gt; --<br>
&gt; Best regards,<br>
&gt; Igor Stasenko.<br>
<br>
</div>Thanks,<br>
Phil</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.&nbsp; <a href="http://www.smalltalkconsulting.com" target="_blank">http://www.smalltalkconsulting.com</a><div>iPhone Apps. &nbsp;<a href="http://www.wikiserver.com" target="_blank">http://www.wikiserver.com</a><br>

===========================================================================<br><br><br></div><br>
</div>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>
</div></blockquote></body></html>