Hi Andreas,<br><br><div class="gmail_quote">On Tue, Apr 28, 2009 at 8:33 PM, Andreas Raab <span dir="ltr">&lt;<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Igor Stasenko wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I came to an idea , you might be interested in.<br>
As many of us know, some CPUs having a special mode - interrupt mode.<br>
What if we introduce the interrupt mode for scheduler?<br>
</blockquote></div>
[... snip ...]<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Now i trying to imagine, how a basic stuff might look like(please<br>
correct me if its utterly wrong way ;), if we will be able to use<br>
interrupt mode.<br>
</blockquote>
<br></div>
This is actually along similar lines of thought that I had when I was thinking of how to get rid of the builtin VM scheduling behavior. The main thought that I had was that the VM may have a &quot;special&quot; process - the scheduler process (duh!) which it runs when it doesn&#39;t know what else to do. The VM would then not directly schedule processes after semaphore signals but rather put them onto a &quot;ready&quot; queue that can be read by the scheduler process and switch to the scheduler process. The scheduler process decides what to run next and resumes the process via a primitive. Whenever an external signal comes in, the VM automatically activates the scheduler process and the scheduler process then decides whether to resume the previously running process or to switch to a different process.<br>

<br>
In a way this folds the timer process into the scheduler (which makes good sense from my perspective because much of the work in the timer is stuff that could be more effectively take place in the scheduler). The implementation should be relatively straightforward - just add a scheduler process and a ready list to the special objects, and wherever the VM would normally process switch you just switch to the scheduler. Voila, there is your user-manipulable scheduler ;-) And obviously, anything that is run out of the scheduler process is by definition non-interruptable because there is simply nothing to switch to!</blockquote>
<div><br></div><div>How would you generalise this to a natively multi-threaded VM?  Obviously one simple way is to stop the other processors at a suspension point before letting the scheduler process proceed, but is there anything cleverer that doesn&#39;t halt all processors until the singleton scheduler has made its mind up?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Cheers,<br><font color="#888888">
  - Andreas<br>
<br>
</font></blockquote></div><br>