trufflesqueak
trufflesqueak copied to clipboard
Higher-priority processes are not scheduled
The following
[10 seconds busyWait] forkAt: 39.
blocks my entire image for 10 seconds, the UI process does not get scheduled before the busy wait is over. In the OSVM, this works, however.
Does the implementation of busyWait
has a suspension point or is this accidental behavior of the OSVM? I could not find an official definition of suspension points, unfortunately ...
However, even if I modify #busyWait
and insert a Processor yield
inside the loop, the observed behavior does not change, so I guess something with the scheduler does not work as expected here.
#busyWait
uses [Time utcMicrosecondClock >= proceedTime] whileFalse
, which is a block that includes primitive calls only. Therefore, this is a different form of the issue documented in https://github.com/hpi-swa/trufflesqueak/issues/104.
But Processor yield
didn't help, so isn't there something wrong with primitiveYield?
But Processor yield didn't help, so isn't there something wrong with primitiveYield?
No, as you mentioned, Processor yield
is a primitive calls as well so the loop body remains trivial in the sense that there is no actual send that would trigger a check for interrupts. As a consequence, TruffleSqueak's bytecode loop will not be interrupted until the loop is exited. In https://github.com/hpi-swa/trufflesqueak/commit/581730f9f927bdfee65fe67ee687f4cca68a4329, I drafted an idea that adds interrupt checks to the bytecode loop for such trivial loops. While this fixes both #167 and #104, we need to run the benchmarks to see how much it impacts peak performance.
Maybe you are right though, not sure why primitiveYield doesn't resolve the problem. Looks like I may need to take another look at the primitive.
Nope, my first comment was correct: you put the yield into busyWait and not into the block itself. Since the block contains no actual sends and no explicit yield, the bytecode loop is not exited until the timer expires. So indeed, we need to make sure to check for interrupts in such trivial loops.