<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hi Jaromir.<div><br></div><div>Wow! That's a thorough experiment. :-) Maybe also add your current conclusions to that other thread: http://forum.world.st/The-Inbox-Kernel-jar-1368-mcz-tp5126894p5126897.html</div><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div><blockquote class='history_container' type='cite' style='border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;'>
                        <p style='color: #AAAAAA; margin-top: 10px;'>Am 05.03.2021 09:56:35 schrieb Jaromir Matas <m@jaromir.net>:</p><div style='font-family:Arial,Helvetica,sans-serif'>Hi, I tried to test how #valueNoContextSwitch behavior differs from #value. I<br>created a victim process p and an intruder process q trying to attack where<br>the difference between #valueNoContextSwitch and #value should lie: between<br>the #value send and the first context switching point inside the block, i.e.<br>between points (A) and (B) here:<br><br>process p (victim):<br><br>   [ x := nil. "(A)" [x "(B)" ifNotNil: ["report intrusion"]] value ]<br>"repeat many times"<br><br>process q (intruder, higher priority) <br><br>   [x := 1. "wait a bit"] "repeat"<br><br>The #value send is a context switching point too but it's the only one<br>between A and B in case of #valueNoContextSwitch. So if there were more<br>switching points inside #value we should see a difference. Unfortunately, I<br>couldn't see any difference and would really appreaciate your advice where I<br>am wrong. Here's the whole testing set (outer fork for shielding from UI):<br><br>[<br>| p q x val sema log cycle attempts |<br>x := val := nil. attempts := 0. cycle := 0. sema := Semaphore new. log := {}<br>writeStream.<br>p := [sema wait. <br>       [x := nil. [val := x. val ifNotNil: [log nextPut: cycle]]<br>valueNoContextSwitch. <br>     cycle := cycle + 1. cycle < 100000000] whileTrue. <br> Transcript cr; show: 'intrusions: ', log contents size] forkAt: 42.<br>q := [sema signal. <br>      [x := 1. attempts := attempts + 1.<br>    3 milliSeconds wait. <br> p isTerminated] whileFalse. <br>  Transcript show: ' out of ', attempts, ' attempts in ', cycle, ' cycles']<br>forkAt: 43.<br>] forkAt: 41<br><br>The results in both cases are almost identical:<br><br>value:<br>intrusions: 178 out of 331 attempts in 100000000 cycles<br>intrusions: 189 out of 324 attempts in 100000000 cycles<br><br>valueNoContextSwitch:<br>intrusions: 194 out of 338 attempts in 100000000 cycles<br>intrusions: 191 out of 328 attempts in 100000000 cycles<br><br><br>As a side-effect I verified a faulty behavior of #valueUnpreemptively I<br>reported here: <br>http://forum.world.st/The-Inbox-Kernel-jar-1368-mcz-tp5126894p5126897.html<br><http: forum.world.st/the-inbox-kernel-jar-1368-mcz-tp5126894p5126897.html="">  <br><br>#valueUnpreemptively returns e.g. the following:<br><br>intrusions: 0 out of 2 attempts in 100000000 cycles<br>intrusions: 3 out of 6 attempts in 100000000 cycles<br><br>This shows the process p runs at priority 80 even after #valueUnpreemptively<br>ended and p returned to its previous lower than q priority. As a result q<br>almost never gets a chance to execute even if it has a higher priority than<br>p most of the time.<br><br>In addition, when I tried to apply the fix I suggested in <br>http://forum.world.st/The-Inbox-Kernel-jar-1368-mcz-tp5126894p5126897.html<br><http: forum.world.st/the-inbox-kernel-jar-1368-mcz-tp5126894p5126897.html=""> <br>, the performance deteriorated so badly that I'm going to recall my<br>suggestion (the only reasonable solution to fix the priority issue is a new<br>primitive).<br><br><br>Any suggestion regarding #valueNoContextSwitch test and where my design is<br>wrong would be greatly appreciated.<br>Thanks,<br><br><br><br><br>-----<br>^[^ Jaromir<br>--<br>Sent from: http://forum.world.st/Squeak-Dev-f45488.html<br><br></http:></http:></div></blockquote>
                                        </div></body>