<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Christoph,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 1, 2021 at 8:29 AM Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" target="_blank">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div id="gmail-m_-9019339879646920306gmail-m_-1791771903634925943divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p>Hi all,</p>
<p><br>
</p>
<p>in the context of the current Transcript debate [1], I am trying to figure out whether, and why Marcel's proposed implementation of <noContextSwitch> [2] could work.</p>
<p><br>
</p>
<p>As a minimum example to test #valueNoContextSwitch, I tried the following:</p>
<p><br>
</p>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<p><span style="font-size:12pt">"Try to run </span><span style="font-size:12pt">this
</span><span style="font-size:12pt">infinite</span><span style="font-size:12pt"> loop</span><span style="font-size:12pt"> unpreemptively."</span><br>
</p>
<p></p>
<p></p>
<div>[</div>
<p></p>
<p></p>
<div><span style="white-space:pre-wrap"></span>[[false] whileFalse] valueNoContextSwitch.</div>
<p></p>
<p></p>
<div><span style="white-space:pre-wrap"></span>self inform: #done</div>
<p></p>
<p></p>
<div>] forkAt: Processor userBackgroundPriority.</div>
<p></p>
<p></p>
<div></div>
<p></p>
</blockquote>
<p><br>
</p>
<p>Now I would have expected my image (its UI process) to freeze while p2 is running unpreemptively. </p></div></div></blockquote><div><br></div><div class="gmail_default"><font face="arial, sans-serif">RTFM :-)</font></div><div class="gmail_default"><font face="arial, sans-serif"><br></font></div><div class="gmail_default" style="color:rgb(0,0,0)"></div><div class="gmail_default"><font face="arial, sans-serif"><span style="white-space:pre-wrap;color:rgb(0,0,0)">     </span>An exact copy of BlockClosure>>value except that this version will not preempt</font></div><div class="gmail_default"><font face="arial, sans-serif"><span style="white-space:pre-wrap">        </span> the current process on block activation if a higher-priority process is runnable.</font></div><div class="gmail_default"><font face="arial, sans-serif"><span style="white-space:pre-wrap">   </span> Primitive. Essential.</font></div><div class="gmail_default"><font face="arial, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, sans-serif">i.e. this has an effect only on activating the block.  Once the block is running preemption is still possible.  All that it guarantees is that no preemption is possible from immediately before the send of <span style="color:rgb(0,0,0)">valueNoContextSwitch to the first send in the block activation.  </span></font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div id="gmail-m_-9019339879646920306gmail-m_-1791771903634925943divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr"><p>But - nothing happens, i.e., all other processes are still activated! I also exchanged <span>valueNoContextSwitch with <span>valueUninterruptably (which I implemented
 using primitive 123 analogously to <<span>noContextSwitch>) with the same result.</span></span></span></p>
<p><span><span><span><br>
</span></span></span></p>
<p><span><span><span>Here is my question: Am I misunderstanding the concept of unpreemptive/uninterruptable execution (are those two terms really synonyms?), or is unpreempted execution broken?</span></span></span></p></div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">They're not synonyms, but neither of them apply to valueNoContextSwitch, nor my proposed pragma which should perhaps be <noContextSwitchOnActivation></div><div class="gmail_default" style="font-size:small"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div id="gmail-m_-9019339879646920306gmail-m_-1791771903634925943divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p><span><span><span>Assuming the former is the case, what else would be a good and simple way to find out if a process is being run unpreemptively?</span></span></span></p>
<p><span><span><span>And do we have any good documentation of this concept - self-documenting tests will be preferred? :-)</span></span></span></p></div></div></blockquote><div><font face="arial, sans-serif" size="1"><br></font></div><div class="gmail_default"><font face="arial, sans-serif" size="1">A test might have a lower priority process in some kind of loop that invokes a block via valueNoContextSwitch, or calls a method marked with <span style="color:rgb(0,0,0)"><noContextSwitchOnActivation>. This process would be run from a higher priority process that would loop waiting for a short delay (1 microsecond?).  Ocne past its delay it would preempt the lower priority process, sample its pc and fail if the pc was the first pc of </span><span style="color:rgb(0,0,0)">valueNoContextSwitch or </span><span style="color:rgb(0,0,0)">a method marked with </span><span style="color:rgb(0,0,0)"><noContextSwitchOnActivation>.</span></font></div><div class="gmail_default"><span style="color:rgb(0,0,0)"><font face="arial, sans-serif" size="1"><br></font></span></div><div class="gmail_default"><font face="arial, sans-serif" size="1"><span style="color:rgb(0,0,0)">A test with two such lower priority processes could be used to test processPreemptionYields == false. If </span><span style="color:rgb(0,0,0)">processPreemptionYields == true then every preemption would cause the two lower priority processes to switch order. If </span><span style="color:rgb(0,0,0)">processPreemptionYields == false the second one would not run until the first one yielded explicitly, or waited, etc.</span></font></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(0,0,0);font-family:-webkit-standard;font-size:medium"><br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div id="gmail-m_-9019339879646920306gmail-m_-1791771903634925943divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p><span style="font-size:12pt">Best,</span><br></p>
<p><span><span><span>Christoph</span></span></span></p>
<p><br>
</p>
<p>[1] <a href="http://forum.world.st/Transcript-error-when-forceUpdate-false-td5126397.html" id="gmail-m_-9019339879646920306gmail-m_-1791771903634925943LPlnk779294" target="_blank">http://forum.world.st/Transcript-error-when-forceUpdate-false-td5126397.html</a></p>
<div id="gmail-m_-9019339879646920306gmail-m_-1791771903634925943Signature">
<div id="gmail-m_-9019339879646920306gmail-m_-1791771903634925943divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="divtagdefaultwrapper">
<div>
<div id="gmail-m_-9019339879646920306gmail-m_-1791771903634925943Item.MessagePartBody">[2] <a href="http://forum.world.st/The-Inbox-Compiler-mt-454-mcz-td5126568.html" id="gmail-m_-9019339879646920306gmail-m_-1791771903634925943LPlnk639407" target="_blank">http://forum.world.st/The-Inbox-Compiler-mt-454-mcz-td5126568.html</a></div>
<br>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
</div>

<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><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></div></div></div></div></div></div></div></div></div></div>